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


Java ReadTimeoutHandler类代码示例

本文整理汇总了Java中org.jboss.netty.handler.timeout.ReadTimeoutHandler的典型用法代码示例。如果您正苦于以下问题:Java ReadTimeoutHandler类的具体用法?Java ReadTimeoutHandler怎么用?Java ReadTimeoutHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ReadTimeoutHandler类属于org.jboss.netty.handler.timeout包,在下文中一共展示了ReadTimeoutHandler类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPipeline

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
    RPCChannelHandler channelHandler = 
            new RPCChannelHandler(syncManager, rpcService);

    IdleStateHandler idleHandler = 
            new IdleStateHandler(timer, 5, 10, 0);
    ReadTimeoutHandler readTimeoutHandler = 
            new ReadTimeoutHandler(timer, 30);
    
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("idle", idleHandler);
    pipeline.addLast("timeout", readTimeoutHandler);
    pipeline.addLast("handshaketimeout",
                     new HandshakeTimeoutHandler(channelHandler, timer, 10));

    pipeline.addLast("frameDecoder",
                     new ThriftFrameDecoder(maxFrameSize));
    pipeline.addLast("frameEncoder",
                     new ThriftFrameEncoder());

    pipeline.addLast("handler", channelHandler);
    return pipeline;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:25,代码来源:RPCPipelineFactory.java

示例2: connect

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
@Override
public void connect() {

	workerService = createWorkerService(getThreadPoolType(CollectorProperties.WRITER.COLLECTOR_WORKER_THREAD_POOL));

	workerbossService = createWorkderBossService(getThreadPoolType(CollectorProperties.WRITER.COLLECTOR_WORKERBOSS_THREAD_POOL));
	channelFactory = new NioServerSocketChannelFactory(workerbossService,
			workerService);

	bootstrap = new ServerBootstrap(channelFactory);

	bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
		@Override
		public ChannelPipeline getPipeline() throws Exception {
			return Channels.pipeline(ipFilterHandler,
					new MessageFrameDecoder(), new ReadTimeoutHandler(
							HashedWheelTimerFactory.getInstance(),
							readTimeout, TimeUnit.MILLISECONDS),
					metricsHandler, channelHandler);
		}
	});

	bootstrap.bind(new InetSocketAddress(port));

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:26,代码来源:CollectorServerImpl.java

示例3: init

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
private void init(IOFSwitchManager switchManager, Timer timer,
		INewOFConnectionListener connectionListener,
		IDebugCounterService debugCounters,
		@Nonnull List<U32> ofBitmaps,
		@Nonnull OFFactory defaultFactory) {
	this.switchManager = switchManager;
	this.connectionListener = connectionListener;
	this.timer = timer;
	this.debugCounters = debugCounters;
	this.defaultFactory = defaultFactory;
	this.ofBitmaps = ofBitmaps;
	this.idleHandler = new IdleStateHandler(
			timer,
			PipelineIdleReadTimeout.MAIN,
			PipelineIdleWriteTimeout.MAIN,
			0);
	this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
}
 
开发者ID:rhoybeen,项目名称:floodlightLB,代码行数:19,代码来源:OpenflowPipelineFactory.java

示例4: getPipeline

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
/**
 * creates a new pipeline for interacting with the
 * controller.  This is where the controllerHandler and
 * the timeouthandler come into play
 * @return the pipeline (ChannelPipeline) for a new Socket.
 */
private ChannelPipeline getPipeline(){
	ChannelPipeline pipe = Channels.pipeline();
    
	ChannelHandler idleHandler = new IdleStateHandler(timer, 20, 25, 0);
    ChannelHandler readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
    OFControllerChannelHandler controllerHandler = new OFControllerChannelHandler();
	
       pipe.addLast("ofmessagedecoder", new OFMessageDecoder());
       pipe.addLast("ofmessageencoder", new OFMessageEncoder());
       pipe.addLast("idle", idleHandler);
       pipe.addLast("timeout", readTimeoutHandler);
       pipe.addLast("handshaketimeout",
                    new ControllerHandshakeTimeoutHandler(controllerHandler, timer, 15));
       pipe.addLast("handler", controllerHandler);
       return pipe;
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:23,代码来源:ControllerConnector.java

示例5: OpenflowPipelineFactory

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
public OpenflowPipelineFactory(Controller controller,
                               ThreadPoolExecutor pipelineExecutor,
                               SSLContext sslContext) {
    super();
    this.controller = controller;
    this.pipelineExecutor = pipelineExecutor;
    this.timer = new HashedWheelTimer();
    this.idleHandler = new IdleStateHandler(timer, 20, 25, 0);
    this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
    this.sslContext = sslContext;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:OpenflowPipelineFactory.java

示例6: BgpPipelineFactory

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
/**
 * Constructor to initialize the values.
 *
 * @param bgpController parent controller
 * @param isBgpServ if it is a server or remote peer
 */
public BgpPipelineFactory(BgpController bgpController, boolean isBgpServ) {
    super();
    this.isBgpServ = isBgpServ;
    this.bgpController = bgpController;
    /* hold time */
    this.readTimeoutHandler = new ReadTimeoutHandler(TIMER, bgpController.getConfig().getHoldTime());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:BgpPipelineFactory.java

示例7: init

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
private void init(IOFSwitchManager switchManager, Timer timer,
		INewOFConnectionListener connectionListener,
		IDebugCounterService debugCounters) {
	this.switchManager = switchManager;
	this.connectionListener = connectionListener;
	this.timer = timer;
	this.debugCounters = debugCounters;
	this.idleHandler = new IdleStateHandler(
			timer,
			PipelineIdleReadTimeout.MAIN,
			PipelineIdleWriteTimeout.MAIN,
			0);
	this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:15,代码来源:OpenflowPipelineFactory.java

示例8: OpenflowPipelineFactory

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
public OpenflowPipelineFactory(Controller controller,
                               ThreadPoolExecutor pipelineExecutor) {
    super();
    this.controller = controller;
    this.pipelineExecutor = pipelineExecutor;
    this.timer = new HashedWheelTimer();
    this.idleHandler = new IdleStateHandler(timer, 20, 25, 0);
    this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:10,代码来源:OpenflowPipelineFactory.java

示例9: getPipeline

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
	final ChannelPipeline pipeline = new DefaultChannelPipeline();
	pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 10));
	pipeline.addLast("encoder", new RS2Encoder());
	pipeline.addLast("decoder", new RS2LoginProtocol());
	pipeline.addLast("handler", new ChannelHandler());
	return pipeline;
}
 
开发者ID:Jarinus,项目名称:osrs-private-server,代码行数:10,代码来源:PipelineFactory.java

示例10: OpenflowPipelineFactory

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
public OpenflowPipelineFactory(IOFSwitchManager switchManager, Timer timer,
                               INewOFConnectionListener connectionListener,
                              IDebugCounterService debugCounters) {
    super();
    this.switchManager = switchManager;
    this.connectionListener = connectionListener;
    this.timer = timer;
    this.debugCounters = debugCounters;
    this.idleHandler = new IdleStateHandler(
                                            timer,
                                            PipelineIdleReadTimeout.MAIN,
                                            PipelineIdleWriteTimeout.MAIN,
                                            0);
    this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:16,代码来源:OpenflowPipelineFactory.java

示例11: ClientChannelPipeline

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
public ClientChannelPipeline(
        final OpenVirteXController openVirteXController,
        final ChannelGroup cg, final ThreadPoolExecutor pipelineExecutor,
        final ClientBootstrap bootstrap, final OVXSwitch sw) {
    super();
    this.ctrl = openVirteXController;
    this.pipelineExecutor = pipelineExecutor;
    this.timer = PhysicalNetwork.getTimer();
    this.idleHandler = new IdleStateHandler(this.timer, 20, 25, 0);
    this.readTimeoutHandler = new ReadTimeoutHandler(this.timer, 30);
    this.bootstrap = bootstrap;
    this.sw = sw;
    this.cg = cg;
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:15,代码来源:ClientChannelPipeline.java

示例12: SwitchChannelPipeline

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
public SwitchChannelPipeline(
        final OpenVirteXController openVirteXController,
        final ThreadPoolExecutor pipelineExecutor) {
    super();
    this.ctrl = openVirteXController;
    this.pipelineExecutor = pipelineExecutor;
    this.timer = PhysicalNetwork.getTimer();
    this.idleHandler = new IdleStateHandler(this.timer, 20, 25, 0);
    this.readTimeoutHandler = new ReadTimeoutHandler(this.timer, 30);
    this.eh = new ExecutionHandler(this.pipelineExecutor);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:12,代码来源:SwitchChannelPipeline.java

示例13: initHttpBootstrap

import org.jboss.netty.handler.timeout.ReadTimeoutHandler; //导入依赖的package包/类
private void initHttpBootstrap(int myport) {
	logger.info("initHttpBootstrap...........");
	final ServerConfig serverConfig = new ServerConfig(myport);
	final ChannelGroup channelGroup = new DefaultChannelGroup(getClass().getName());
	bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
			//建议用ThreadPoolExecutor代替
			Executors.newCachedThreadPool(),
			Executors.newCachedThreadPool(), serverConfig.getThreadCnt()));
	//设置常见参数
	bootstrap.setOption("tcpNoDelay","true");//禁用nagle算法
	bootstrap.setOption("reuseAddress", "true");
	bootstrap.setOption("SO_RCVBUF",1024*128);
	bootstrap.setOption("SO_SNDBUF",1024*128);
	timer = new HashedWheelTimer();
	bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
		public ChannelPipeline getPipeline() throws Exception {
			ChannelPipeline pipeline = Channels.pipeline();
			int readTimeout = serverConfig.getReadTimeout();
			if (readTimeout > 0) {
				pipeline.addLast("timeout", new ReadTimeoutHandler(timer, readTimeout, TimeUnit.MILLISECONDS));
			}
			pipeline.addLast("decoder", new RpcRequestDecode());
			pipeline.addLast("encoder", new RpcResponseEncode());
			pipeline.addLast("handler", new NettyRpcServerHandler(channelGroup));
			return pipeline;
		}
	});
	
	int port = serverConfig.getPort();
	if (!checkPortConfig(port)) {
		throw new IllegalStateException("port: " + port + " already in use!");
	}

	Channel channel = bootstrap.bind(new InetSocketAddress(port));
	channelGroup.add(channel);
	logger.info("voyage server started");

	waitForShutdownCommand();
	ChannelGroupFuture future = channelGroup.close();
	future.awaitUninterruptibly();
	bootstrap.releaseExternalResources();
	timer.stop();
	timer = null;

	logger.info("voyage server stoped");

}
 
开发者ID:zhaoshiling1017,项目名称:voyage,代码行数:48,代码来源:RpcServerBootstrap.java


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