Search in sources :

Example 1 with IdleStateHandler

use of org.apache.hbase.thirdparty.io.netty.handler.timeout.IdleStateHandler in project hbase by apache.

the class FanOutOneBlockAsyncDFSOutput method setupReceiver.

private void setupReceiver(int timeoutMs) {
    AckHandler ackHandler = new AckHandler(timeoutMs);
    for (Channel ch : datanodeInfoMap.keySet()) {
        ch.pipeline().addLast(new IdleStateHandler(timeoutMs, timeoutMs / 2, 0, TimeUnit.MILLISECONDS), new ProtobufVarint32FrameDecoder(), new ProtobufDecoder(PipelineAckProto.getDefaultInstance()), ackHandler);
        ch.config().setAutoRead(true);
    }
}
Also used : Channel(org.apache.hbase.thirdparty.io.netty.channel.Channel) IdleStateHandler(org.apache.hbase.thirdparty.io.netty.handler.timeout.IdleStateHandler) ProtobufVarint32FrameDecoder(org.apache.hbase.thirdparty.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder)

Example 2 with IdleStateHandler

use of org.apache.hbase.thirdparty.io.netty.handler.timeout.IdleStateHandler in project hbase by apache.

the class NettyRpcConnection method established.

private void established(Channel ch) throws IOException {
    assert eventLoop.inEventLoop();
    ChannelPipeline p = ch.pipeline();
    String addBeforeHandler = p.context(BufferCallBeforeInitHandler.class).name();
    p.addBefore(addBeforeHandler, null, new IdleStateHandler(0, rpcClient.minIdleTimeBeforeClose, 0, TimeUnit.MILLISECONDS));
    p.addBefore(addBeforeHandler, null, new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4));
    p.addBefore(addBeforeHandler, null, new NettyRpcDuplexHandler(this, rpcClient.cellBlockBuilder, codec, compressor));
    p.fireUserEventTriggered(BufferCallEvent.success());
}
Also used : IdleStateHandler(org.apache.hbase.thirdparty.io.netty.handler.timeout.IdleStateHandler) LengthFieldBasedFrameDecoder(org.apache.hbase.thirdparty.io.netty.handler.codec.LengthFieldBasedFrameDecoder) ChannelPipeline(org.apache.hbase.thirdparty.io.netty.channel.ChannelPipeline)

Aggregations

IdleStateHandler (org.apache.hbase.thirdparty.io.netty.handler.timeout.IdleStateHandler)2 Channel (org.apache.hbase.thirdparty.io.netty.channel.Channel)1 ChannelPipeline (org.apache.hbase.thirdparty.io.netty.channel.ChannelPipeline)1 LengthFieldBasedFrameDecoder (org.apache.hbase.thirdparty.io.netty.handler.codec.LengthFieldBasedFrameDecoder)1 ProtobufVarint32FrameDecoder (org.apache.hbase.thirdparty.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder)1