本文整理汇总了Java中com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState类的典型用法代码示例。如果您正苦于以下问题:Java ChannelState类的具体用法?Java ChannelState怎么用?Java ChannelState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChannelState类属于com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable包,在下文中一共展示了ChannelState类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: received
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例2: received
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例3: received
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例4: received
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例5: connected
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例6: disconnected
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例7: caught
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例8: connected
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例9: disconnected
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例10: received
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}
示例11: caught
import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.ChannelState; //导入依赖的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);
}
}