Example usage for io.netty.handler.flush FlushConsolidationHandler FlushConsolidationHandler

List of usage examples for io.netty.handler.flush FlushConsolidationHandler FlushConsolidationHandler

Introduction

In this page you can find the example usage for io.netty.handler.flush FlushConsolidationHandler FlushConsolidationHandler.

Prototype

public FlushConsolidationHandler() 

Source Link

Document

Create new instance which explicit flush after DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES pending flush operations at the latest.

Usage

From source file:com.linecorp.armeria.client.HttpClientPipelineConfigurator.java

License:Apache License

@Override
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress,
        ChannelPromise promise) throws Exception {

    // Remember the requested remote address for later use.
    final InetSocketAddress inetRemoteAddr = (InetSocketAddress) remoteAddress;
    this.remoteAddress = inetRemoteAddr;

    // Configure the pipeline.
    final Channel ch = ctx.channel();

    final ChannelPipeline p = ch.pipeline();
    p.addLast(new FlushConsolidationHandler());
    p.addLast(ReadSuppressingHandler.INSTANCE);

    try {/*  w  w w.jav a2  s .  c  o m*/
        if (sslCtx != null) {
            configureAsHttps(ch, inetRemoteAddr);
        } else {
            configureAsHttp(ch);
        }
    } catch (Throwable t) {
        promise.tryFailure(t);
        ctx.close();
    } finally {
        if (p.context(this) != null) {
            p.remove(this);
        }
    }

    ctx.connect(remoteAddress, localAddress, promise);
}

From source file:com.linecorp.armeria.server.HttpServerPipelineConfigurator.java

License:Apache License

@Override
protected void initChannel(Channel ch) throws Exception {
    final ChannelPipeline p = ch.pipeline();
    p.addLast(new FlushConsolidationHandler());
    p.addLast(ReadSuppressingHandler.INSTANCE);
    configurePipeline(p, port.protocols(), null);
}