本文整理汇总了Java中com.alibaba.dubbo.remoting.ExecutionException类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionException类的具体用法?Java ExecutionException怎么用?Java ExecutionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionException类属于com.alibaba.dubbo.remoting包,在下文中一共展示了ExecutionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: caught
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void caught(Channel channel, Throwable exception) throws RemotingException {
if (exception instanceof ExecutionException) {
ExecutionException e = (ExecutionException) exception;
Object msg = e.getRequest();
if (msg instanceof Request) {
Request req = (Request) msg;
if (req.isTwoWay() && ! req.isHeartbeat()) {
Response res = new Response(req.getId(), req.getVersion());
res.setStatus(Response.SERVER_ERROR);
res.setErrorMessage(StringUtils.toString(e));
channel.send(res);
return;
}
}
}
ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel);
try {
handler.caught(exchangeChannel, exception);
} finally {
HeaderExchangeChannel.removeChannelIfDisconnected(channel);
}
}
示例2: received
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void received(Channel channel, Object message) throws RemotingException {
ExecutorService cexecutor = getExecutorService();
try {
cexecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
} catch (Throwable t) {
//TODO 临时解决线程池满后异常信息无法发送到对端的问题。待重构
//fix 线程池满了拒绝调用不返回,导致消费者一直等待超时
if (message instanceof Request && t instanceof RejectedExecutionException) {
Request request = (Request) message;
if (request.isTwoWay()) {
String msg = "Server side(" + url.getIp() + "," + url.getPort()
+ ") threadpool is exhausted ,detail msg:" + t.getMessage();
Response response = new Response(request.getId(), request.getVersion());
response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
response.setErrorMessage(msg);
channel.send(response);
return;
}
}
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
}
}
示例3: main
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public static void main(final String... args) {
final ExecutionException ee = new ExecutionException(null, null, "hee");
System.err.println("ee:" + JSON.toJSONString(ee));
System.err.println("em:" + ee.getMessage());
System.err.println("em-1:" + JSON.toJSONString(ee.getClass()));
System.err.println("em-2:" + ee.getClass().getCanonicalName());
final RpcException re = new RpcException("sx");
System.err.println("re:" + JSON.toJSONString(re));
System.err.println("rem:" + re.getMessage());
final TimeoutException te = new TimeoutException(true, null, "sss");
System.err.println("te:" + JSON.toJSONString(te));
@SuppressWarnings("PMD.AvoidThrowingNullPointerException")
final Throwable tb = new NullPointerException("null");
System.err.println("tb:" + JSON.toJSONString(tb));
}
示例4: received
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void received(Channel channel, Object message) throws RemotingException {
try {
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
} catch (Throwable t) {
// fix 线程池满了拒绝调用不返回,导致消费者一直等待超时
if (message instanceof Request && t instanceof RejectedExecutionException) {
Request request = (Request) message;
if (request.isTwoWay()) {
String msg = "Server side(" + url.getIp() + "," + url.getPort()
+ ") threadpool is exhausted ,detail msg:" + t.getMessage();
Response response = new Response(request.getId(), request.getVersion());
response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
response.setErrorMessage(msg);
channel.send(response);
return;
}
}
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
}
}
示例5: received
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void received(Channel channel, Object message) throws RemotingException {
ExecutorService cexecutor = executor;
if (cexecutor == null || cexecutor.isShutdown()) {
cexecutor = SHARED_EXECUTOR;
}
try {
cexecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
} catch (Throwable t) {
// fix 线程池满了拒绝调用不返回,导致消费者一直等待超时
if (message instanceof Request && t instanceof RejectedExecutionException) {
Request request = (Request) message;
if (request.isTwoWay()) {
String msg = "Server side(" + url.getIp() + "," + url.getPort()
+ ") threadpool is exhausted ,detail msg:" + t.getMessage();
Response response = new Response(request.getId(), request.getVersion());
response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
response.setErrorMessage(msg);
channel.send(response);
return;
}
}
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
}
}
示例6: received
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void received(Channel channel, Object message) throws RemotingException {
ExecutorService cexecutor = executor;
if (cexecutor == null || cexecutor.isShutdown()) {
cexecutor = SHARED_EXECUTOR;
}
try {
cexecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
} catch (Throwable t) {
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
}
}
示例7: connected
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void connected(Channel channel) throws RemotingException {
try{
checkQueueLength();
connectionExecutor.execute(new ChannelEventRunnable(channel, handler ,ChannelState.CONNECTED));
}catch (Throwable t) {
throw new ExecutionException("connect event", channel, getClass()+" error when process connected event ." , t);
}
}
示例8: disconnected
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void disconnected(Channel channel) throws RemotingException {
try{
checkQueueLength();
connectionExecutor.execute(new ChannelEventRunnable(channel, handler ,ChannelState.DISCONNECTED));
}catch (Throwable t) {
throw new ExecutionException("disconnected event", channel, getClass()+" error when process disconnected event ." , t);
}
}
示例9: caught
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void caught(Channel channel, Throwable exception) throws RemotingException {
ExecutorService cexecutor = executor;
if (cexecutor == null || cexecutor.isShutdown()) {
cexecutor = SHARED_EXECUTOR;
}
try{
cexecutor.execute(new ChannelEventRunnable(channel, handler ,ChannelState.CAUGHT, exception));
}catch (Throwable t) {
throw new ExecutionException("caught event", channel, getClass()+" error when process caught event ." , t);
}
}
示例10: connected
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void connected(Channel channel) throws RemotingException {
ExecutorService cexecutor = getExecutorService();
try{
cexecutor.execute(new ChannelEventRunnable(channel, handler ,ChannelState.CONNECTED));
}catch (Throwable t) {
throw new ExecutionException("connect event", channel, getClass()+" error when process connected event ." , t);
}
}
示例11: disconnected
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void disconnected(Channel channel) throws RemotingException {
ExecutorService cexecutor = getExecutorService();
try{
cexecutor.execute(new ChannelEventRunnable(channel, handler ,ChannelState.DISCONNECTED));
}catch (Throwable t) {
throw new ExecutionException("disconnect event", channel, getClass()+" error when process disconnected event ." , t);
}
}
示例12: received
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void received(Channel channel, Object message) throws RemotingException {
ExecutorService cexecutor = getExecutorService();
try {
cexecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
} catch (Throwable t) {
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
}
}
示例13: caught
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
public void caught(Channel channel, Throwable exception) throws RemotingException {
ExecutorService cexecutor = getExecutorService();
try{
cexecutor.execute(new ChannelEventRunnable(channel, handler ,ChannelState.CAUGHT, exception));
}catch (Throwable t) {
throw new ExecutionException("caught event", channel, getClass()+" error when process caught event ." , t);
}
}
示例14: test_Connect_Execute_Error
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
@Test(expected = ExecutionException.class)
public void test_Connect_Execute_Error() throws RemotingException{
handler = new ConnectionOrderedChannelHandler(new BizChannelHander(false), url);
ThreadPoolExecutor executor = (ThreadPoolExecutor)getField(handler, "connectionExecutor", 1);
executor.shutdown();
handler.connected(new MockedChannel());
}
示例15: test_Disconnect_Execute_Error
import com.alibaba.dubbo.remoting.ExecutionException; //导入依赖的package包/类
@Test(expected = ExecutionException.class)
public void test_Disconnect_Execute_Error() throws RemotingException{
handler = new ConnectionOrderedChannelHandler(new BizChannelHander(false), url);
ThreadPoolExecutor executor = (ThreadPoolExecutor)getField(handler, "connectionExecutor", 1);
executor.shutdown();
handler.disconnected(new MockedChannel());
}