Examples of ReadTimeoutHandler


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

        // Configure the pipeline factory.
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

            private final ChannelHandler timeoutHandler =
                new ReadTimeoutHandler(timer, READ_TIMEOUT);
            private final ChannelHandler uptimeHandler =
                new UptimeClientHandler(bootstrap, timer);

            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(
View Full Code Here

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

        // do we use request timeout?
        if (producer.getConfiguration().getRequestTimeout() > 0) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout());
            }
            ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
            addToPipeline("timeout", channelPipeline, timeout);
        }

        // our handler must be added last
        addToPipeline("handler", channelPipeline, new ClientChannelHandler(producer));
View Full Code Here

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

    @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);
View Full Code Here

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

        // Configure the pipeline factory.
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(
                        new ReadTimeoutHandler(timer, READ_TIMEOUT),
                        new UptimeClientHandler(bootstrap, timer));
            }
        });

        bootstrap.setOption(
View Full Code Here

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

        Preconditions.checkNotNull(readTimeout, "readTimeout is null");
        Preconditions.checkNotNull(maxContentLength, "maxContentLength is null");

        this.nettyConnectionPool = nettyConnectionPool;
        this.executor = executor;
        this.timeoutHandler = new ReadTimeoutHandler(this.timer, readTimeout.toMillis(), TimeUnit.MILLISECONDS);
        this.maxContentLength = Ints.checkedCast(maxContentLength.toBytes());
    }
View Full Code Here

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

        }
    }

    private ChannelFuture closeChannel(Channel c) {
        LOG.debug("Closing channel {}", c);
        ReadTimeoutHandler timeout = c.getPipeline().get(ReadTimeoutHandler.class);
        if (timeout != null) {
            timeout.releaseExternalResources();
        }
        return c.close();
    }
View Full Code Here

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

     */
    @Override
    public ChannelPipeline getPipeline() throws Exception {
        ChannelPipeline pipeline = Channels.pipeline();

        pipeline.addLast("readTimeout", new ReadTimeoutHandler(new HashedWheelTimer(),
                                                               conf.getReadTimeout()));
        pipeline.addLast("lengthbasedframedecoder", new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH, 0, 4, 0, 4));
        pipeline.addLast("mainhandler", this);
        return pipeline;
    }
View Full Code Here

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

    public ChannelPipeline getPipeline() throws Exception {
        if (timeOut > 0)
            return Channels.pipeline(
                    // new GameBytesCounter(),
                    // new GameEventCounter(),
                    new ReadTimeoutHandler(timeoutHandler, timeOut), // timeout断开连接
                    new FlashCrossDomainDecoder(), new GameDecoder(maxReadSize, 0, GameBufferFactory.getReadHeaderSize(), 0, readOffset),
                    new GameEncoder(),
                    new GameUpStreamer());
        else {
            return Channels.pipeline(
View Full Code Here

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

        // do we use request timeout?
        if (producer.getConfiguration().getRequestTimeout() > 0) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout());
            }
            ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
            addToPipeline("timeout", channelPipeline, timeout);
        }

        // our handler must be added last
        addToPipeline("handler", channelPipeline, new ClientChannelHandler(producer));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.