当前位置: 首页>>代码示例>>Java>>正文


Java ExecutionException类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:23,代码来源:HeaderExchangeHandler.java

示例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);
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:23,代码来源:AllChannelHandler.java

示例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));
}
 
开发者ID:Yirendai,项目名称:cicada,代码行数:20,代码来源:ExceptionTest.java

示例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);
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:21,代码来源:ExecutionChannelHandler.java

示例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);
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:25,代码来源:ConnectionOrderedChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:12,代码来源:MessageOnlyChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:9,代码来源:ConnectionOrderedChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:9,代码来源:ConnectionOrderedChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:12,代码来源:ConnectionOrderedChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:9,代码来源:AllChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:9,代码来源:AllChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:9,代码来源:AllChannelHandler.java

示例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);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:9,代码来源:AllChannelHandler.java

示例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());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:8,代码来源:ConnectChannelHandlerTest.java

示例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());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:8,代码来源:ConnectChannelHandlerTest.java


注:本文中的com.alibaba.dubbo.remoting.ExecutionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。