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


Java ChannelState类代码示例

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

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

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

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

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

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

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

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

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

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

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


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