public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 30)); pipeline.addLast("decoder", new FlashPolicyServerDecoder()); pipeline.addLast("handler", getFlashPolicyServerHandler()); return pipeline; }
public void beforeRemove(ChannelHandlerContext ctx) throws Exception { destroy(ctx); }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { // This method will be invoked only if this handler was added // before channelOpen event is fired. If a user adds this handler // after the channelOpen event, initialize() will be called by beforeAdd(). initialize(ctx); ctx.sendUpstream(e); }
channel.getPipeline().addLast( READ_TIMEOUT_HANDLER_NAME, new ReadTimeoutHandler(timer, readTimeout, TimeUnit.MILLISECONDS) );
public void beforeAdd(ChannelHandlerContext ctx) throws Exception { if (ctx.getPipeline().isAttached()) { // channelOpen event has been fired already, which means // this.channelOpen() will not be invoked. // We have to initialize here instead. initialize(ctx); } else { // channelOpen event has not been fired yet. // this.channelOpen() will be invoked and initialization will occur there. } }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { destroy(ctx); ctx.sendUpstream(e); }
public PcepPipelineFactory(Controller controller) { super(); this.controller = controller; this.idleHandler = new IdleStateHandler(TIMER, DEFAULT_DEAD_TIME, DEFAULT_KEEP_ALIVE_TIME, 0); this.readTimeoutHandler = new ReadTimeoutHandler(TIMER, DEFAULT_WAIT_TIME); }
public PcepPipelineFactory(Controller controller) { super(); this.controller = controller; this.idleHandler = new IdleStateHandler(TIMER, DEFAULT_DEAD_TIME, DEFAULT_KEEP_ALIVE_TIME, 0); this.readTimeoutHandler = new ReadTimeoutHandler(TIMER, DEFAULT_WAIT_TIME); }
public HttpClientPipelineFactory(NettyConnectionPool nettyConnectionPool, Timer timer, OrderedMemoryAwareThreadPoolExecutor executor, Duration readTimeout, DataSize maxContentLength) { this.timer = timer; Preconditions.checkNotNull(nettyConnectionPool, "nettyConnectionPool is null"); Preconditions.checkNotNull(executor, "executor is null"); Preconditions.checkNotNull(readTimeout, "readTimeout is null"); Preconditions.checkNotNull(maxContentLength, "maxContentLength is null"); this.nettyConnectionPool = nettyConnectionPool; this.executor = executor; this.timeoutHandler = new ReadTimeoutHandler(this.timer, (long) readTimeout.toMillis(), TimeUnit.MILLISECONDS); this.maxContentLength = Ints.checkedCast(maxContentLength.toBytes()); }
@Override protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getBaseChannelHandlers(MessageInput input) { final LinkedHashMap<String, Callable<? extends ChannelHandler>> baseChannelHandlers = super.getBaseChannelHandlers(input); if (idleWriterTimeout > 0) { // Install read timeout handler to close idle connections after a timeout. // This avoids dangling HTTP connections when the HTTP client does not close the connection properly. // For details see: https://github.com/Graylog2/graylog2-server/issues/3223#issuecomment-270350500 baseChannelHandlers.put("read-timeout-handler", () -> new ReadTimeoutHandler(timer, idleWriterTimeout, TimeUnit.SECONDS)); } baseChannelHandlers.put("decoder", () -> new HttpRequestDecoder(DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_MAX_HEADER_SIZE, maxChunkSize)); baseChannelHandlers.put("aggregator", () -> new HttpChunkAggregator(maxChunkSize)); baseChannelHandlers.put("encoder", HttpResponseEncoder::new); baseChannelHandlers.put("decompressor", HttpContentDecompressor::new); return baseChannelHandlers; }
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; }
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; }
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); }
public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 30)); pipeline.addLast("decoder", new FlashPolicyServerDecoder()); pipeline.addLast("handler", new FlashPolicyServerHandler()); return pipeline; } }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); Timer timer = new HashedWheelTimer(); pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 30)); pipeline.addLast("codec", new HttpClientCodec()); if (ssl) { SSLContext sslContext = SSLContext.getInstance("TLS"); //sslContext.init(keyManagers, trustManagers, null); SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(true); pipeline.addLast("ssl", new SslHandler(engine)); } //handle HttpChunks pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); //automatic content decompression //pipeline.addLast("inflater", new HttpContentDecompressor()); pipeline.addLast("handler", new HttpResponseHandler()); return pipeline; } }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline p = Channels.pipeline(); timer = new HashedWheelTimer(); p.addLast("frameDecoder", new NettyFrameDecoder()); p.addLast("frameEncoder", new NettyFrameEncoder()); p.addLast("handler", new NettyClientWaspHandler()); p.addLast( "readTimeout", new ReadTimeoutHandler(timer, NettyTransceiver.this.conf.getInt( FConstants.CONNECTION_READ_TIMEOUT_SEC, FConstants.DEFAULT_CONNECTION_READ_TIMEOUT_SEC))); p.addLast( "writeTimeout", new WriteTimeoutHandler(timer, NettyTransceiver.this.conf.getInt( FConstants.CONNECTION_WRITE_TIMEOUT_SEC, FConstants.DEFAULT_CONNECTION_WRITE_TIMEOUT_SEC))); return p; } });
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; } });
LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout()); ChannelHandler timeout = new ReadTimeoutHandler(producer.getEndpoint().getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS); addToPipeline("timeout", channelPipeline, timeout);
channel.getPipeline().addLast( READ_TIMEOUT_HANDLER_NAME, new ReadTimeoutHandler(timer, readTimeout.getMillis(), TimeUnit.MILLISECONDS) );
LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout()); ChannelHandler timeout = new ReadTimeoutHandler(producer.getEndpoint().getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS); pipeline.addLast("timeout", timeout);