Package org.jboss.netty.handler.timeout

Examples of org.jboss.netty.handler.timeout.IdleStateHandler


    return createIdleStateHandler(r, w, 0L, unit);
  }
 
  public static IdleStateHandler createIdleStateHandler(
      long r, long w, long rw, TimeUnit unit) {
    return new IdleStateHandler(TIMER, r, w, rw, unit);
  }
View Full Code Here


    tcpServer = new ServerBootstrap(new NioServerSocketChannelFactory(
        Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
    tcpServer.setPipelineFactory(new ChannelPipelineFactory() {
      private final HashedWheelTimer timer = new HashedWheelTimer();
      private final IdleStateHandler idleStateHandler = new IdleStateHandler(
          timer, 0, 0, idleTimeMilliSeconds, TimeUnit.MILLISECONDS);

      @Override
      public ChannelPipeline getPipeline() throws Exception {
        return Channels.pipeline(RpcUtil.constructRpcFrameDecoder(),
View Full Code Here

                            readTimeout = clientAuth.getNetReadTimeout();
                        }
                        if (clientAuth.getNetWriteTimeout() > 0) {
                            writeTimeout = clientAuth.getNetWriteTimeout();
                        }
                        IdleStateHandler idleStateHandler = new IdleStateHandler(NettyUtils.hashedWheelTimer,
                                                                                 readTimeout, writeTimeout, 0);
                        ctx.getPipeline().addBefore(SessionHandler.class.getName(), IdleStateHandler.class.getName(),
                                                    idleStateHandler);

                        IdleStateAwareChannelHandler idleStateAwareChannelHandler = new IdleStateAwareChannelHandler() {
View Full Code Here

                cp.addLast(ChannelStatistics.NAME, new ChannelStatistics(allChannels));
                cp.addLast("frameCodec", def.getThriftFrameCodecFactory().create(def.getMaxFrameSize(),
                                                                                 inputProtocolFactory));
                if (def.getClientIdleTimeout() != null) {
                    // Add handlers to detect idle client connections and disconnect them
                    cp.addLast("idleTimeoutHandler", new IdleStateHandler(timer,
                                                                          (int) def.getClientIdleTimeout().toMillis(),
                                                                          NO_WRITER_IDLE_TIMEOUT,
                                                                          NO_ALL_IDLE_TIMEOUT,
                                                                          TimeUnit.MILLISECONDS));
                    cp.addLast("idleDisconnectHandler", new IdleDisconnectHandler());
View Full Code Here

                cp.addLast(ChannelStatistics.NAME, new ChannelStatistics(allChannels));
                cp.addLast("frameCodec", def.getThriftFrameCodecFactory().create(def.getMaxFrameSize(),
                                                                                 inputProtocolFactory));
                if (def.getClientIdleTimeout() != null) {
                    // Add handlers to detect idle client connections and disconnect them
                    cp.addLast("idleTimeoutHandler", new IdleStateHandler(nettyServerConfig.getTimer(),
                                                                          Ints.checkedCast(def.getClientIdleTimeout().toMillis()),
                                                                          NO_WRITER_IDLE_TIMEOUT,
                                                                          NO_ALL_IDLE_TIMEOUT,
                                                                          TimeUnit.MILLISECONDS));
                    cp.addLast("idleDisconnectHandler", new IdleDisconnectHandler());
View Full Code Here

                    cp.addLast(ChannelStatistics.NAME, new ChannelStatistics(allChannels));
                    cp.addLast("frameDecoder", new ThriftFrameDecoder(def.getMaxFrameSize(),
                                                                      def.getInProtocolFactory()));
                    if (def.getClientIdleTimeout() != null) {
                        // Add handlers to detect idle client connections and disconnect them
                        cp.addLast("idleTimeoutHandler", new IdleStateHandler(timer,
                                                                              (int)def.getClientIdleTimeout().toMillis(),
                                                                              NO_WRITER_IDLE_TIMEOUT,
                                                                              NO_ALL_IDLE_TIMEOUT,
                                                                              TimeUnit.MILLISECONDS
                                                                              ));
View Full Code Here

                            readTimeout = clientAuth.getNetReadTimeout();
                        }
                        if (clientAuth.getNetWriteTimeout() > 0) {
                            writeTimeout = clientAuth.getNetWriteTimeout();
                        }
                        IdleStateHandler idleStateHandler = new IdleStateHandler(NettyUtils.hashedWheelTimer,
                            readTimeout,
                            writeTimeout,
                            0);
                        ctx.getPipeline().addBefore(SessionHandler.class.getName(),
                            IdleStateHandler.class.getName(),
View Full Code Here

   * @see org.jboss.netty.channel.ChannelPipelineFactory#getPipeline()
   */
  public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline channelPipeline = Channels.pipeline();
    if (this.getIdleStateAwareChannelHandlerBean()!= null) {
      channelPipeline.addLast("idleStateCheck", new IdleStateHandler(timer, 0L, 0L, this.getChannelIdleTimeMillis(),TimeUnit.MILLISECONDS));
      channelPipeline.addLast("idleCheckHandler", (ChannelHandler)this.applicationContext.getBean(this.getIdleStateAwareChannelHandlerBean()));
    }
    for (String handlerKey : this.getChannelHandlerBeanNamesMap().keySet()) {
      channelPipeline.addLast(handlerKey, (ChannelHandler)this.applicationContext.getBean(this.getChannelHandlerBeanNamesMap().get(handlerKey)));
    }
View Full Code Here

                cp.addLast(ChannelStatistics.NAME, channelStatistics);
                cp.addLast("frameCodec", def.getThriftFrameCodecFactory().create(def.getMaxFrameSize(),
                                                                                 inputProtocolFactory));
                if (def.getClientIdleTimeout() != null) {
                    // Add handlers to detect idle client connections and disconnect them
                    cp.addLast("idleTimeoutHandler", new IdleStateHandler(nettyServerConfig.getTimer(),
                                                                          def.getClientIdleTimeout().toMillis(),
                                                                          NO_WRITER_IDLE_TIMEOUT,
                                                                          NO_ALL_IDLE_TIMEOUT,
                                                                          TimeUnit.MILLISECONDS));
                    cp.addLast("idleDisconnectHandler", new IdleDisconnectHandler());
View Full Code Here

            private final TimeUnit TIMEOUT_UNIT = TimeUnit.SECONDS;

            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline pipeline = pipeline();
                pipeline.addLast(GROUP_HANDLER, groupHandler);
                pipeline.addLast("idleHandler", new IdleStateHandler(timer, 0, 0, timeout, TIMEOUT_UNIT));
                pipeline.addLast(TIMEOUT_HANDLER, new ImapIdleStateHandler());
                pipeline.addLast(CONNECTION_LIMIT_HANDLER, new ConnectionLimitUpstreamHandler(IMAPServer.this.connectionLimit));

                pipeline.addLast(CONNECTION_LIMIT_PER_IP_HANDLER, new ConnectionPerIpLimitUpstreamHandler(IMAPServer.this.connPerIP));
View Full Code Here

TOP

Related Classes of org.jboss.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.