Package io.netty.handler.timeout

Examples of io.netty.handler.timeout.IdleStateHandler


    this.channelHandlerBuilder = channelHandlerBuilder;
  }

  @Override
  protected void initChannel(SocketChannel ch) throws Exception {
    ch.pipeline().addLast(new SocksInitRequestDecoder()).addLast(new SocksCmdRequestDecoder()).addLast(new IdleStateHandler(this.idleRead, this.idleWrite, this.idleAll)).addLast(this.channelHandlerBuilder.build());
  }
View Full Code Here


    this.idleWrite = idleWrite;
    this.channelHandlerBuilder = channelHandlerBuilder;
  }

  public void initChannel(SocketChannel ch) throws Exception {
    ch.pipeline().addLast(new IdleStateHandler(this.idleRead, this.idleWrite, this.idleAll)).addLast(this.channelHandlerBuilder.build());
  }
View Full Code Here

                  }

                  if (apnsConnection.configuration.getCloseAfterInactivityTime() != null) {
                    connectFuture.channel().pipeline().addBefore(ApnsConnection.PIPELINE_MAIN_HANDLER,
                        ApnsConnection.PIPELINE_IDLE_STATE_HANDLER,
                        new IdleStateHandler(0, 0, apnsConnection.configuration.getCloseAfterInactivityTime()));
                  }

                } else {
                  log.debug("{} failed to complete TLS handshake with APNs gateway.",
                      apnsConnection.name, handshakeFuture.cause());
View Full Code Here

                apnsConnection.connectFuture.channel().pipeline().get(PIPELINE_GRACEFUL_SHUTDOWN_TIMEOUT_HANDLER) == null) {
              // We should time out, but haven't added an idle state handler yet.
              apnsConnection.connectFuture.channel().pipeline().addBefore(
                  PIPELINE_MAIN_HANDLER,
                  PIPELINE_GRACEFUL_SHUTDOWN_TIMEOUT_HANDLER,
                  new IdleStateHandler(apnsConnection.configuration.getGracefulShutdownTimeout(), 0, 0));
            }


            apnsConnection.pendingWriteCount += 1;
View Full Code Here

                public void initChannel(SocketChannel ch) throws Exception {
                    ch.pipeline().addLast(//
                        defaultEventExecutorGroup, //
                        new NettyEncoder(), //
                        new NettyDecoder(), //
                        new IdleStateHandler(0, 0, nettyClientConfig.getClientChannelMaxIdleTimeSeconds()),//
                        new NettyConnetManageHandler(), //
                        new NettyClientHandler());
                }
            });
View Full Code Here

                            ch.pipeline().addLast(
                                //
                                defaultEventExecutorGroup, //
                                new NettyEncoder(), //
                                new NettyDecoder(), //
                                new IdleStateHandler(0, 0, nettyServerConfig
                                    .getServerChannelMaxIdleTimeSeconds()),//
                                new NettyConnetManageHandler(), //
                                new NettyServerHandler());
                        }
                    });
View Full Code Here

        bootstrap.group(bossGroup, workerGroup)
            .channel(NioServerSocketChannel.class)
            .option(ChannelOption.SO_REUSEADDR, true);
               
        // Set up the idle handler
        IdleStateHandler idleStateHandler =
            new IdleStateHandler(getReadIdleTime(), getWriteIdleTime(), 0);
        // Set up the event pipeline factory.
        servletPipeline =
            new NettyHttpServletPipelineFactory(
                 tlsServerParameters, sessionSupport,
                 threadingParameters.getThreadPoolSize(),
View Full Code Here

         .channel(NioSocketChannel.class)
         .remoteAddress(host, port)
         .handler(new ChannelInitializer<SocketChannel>() {
            @Override
            public void initChannel(SocketChannel ch) throws Exception {
                ch.pipeline().addLast(new IdleStateHandler(READ_TIMEOUT, 0, 0), handler);
            }
         });

        return b;
    }
View Full Code Here

      return this;
    }

    @Override
    public ConsumerSpec readIdle(long idleTimeout, final Runnable onReadIdle) {
      ioChannel.pipeline().addFirst(new IdleStateHandler(idleTimeout, 0, 0, TimeUnit.MILLISECONDS) {
        @Override
        protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception {
          if (evt.state() == IdleState.READER_IDLE) {
            onReadIdle.run();
          }
View Full Code Here

      return this;
    }

    @Override
    public ConsumerSpec writeIdle(long idleTimeout, final Runnable onWriteIdle) {
      ioChannel.pipeline().addLast(new IdleStateHandler(0, idleTimeout, 0, TimeUnit.MILLISECONDS) {
        @Override
        protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception {
          if (evt.state() == IdleState.WRITER_IDLE) {
            onWriteIdle.run();
          }
View Full Code Here

TOP

Related Classes of io.netty.handler.timeout.IdleStateHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.