Search in sources :

Example 6 with Channel

use of org.apache.hbase.thirdparty.io.netty.channel.Channel 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 7 with Channel

use of org.apache.hbase.thirdparty.io.netty.channel.Channel in project hbase by apache.

the class NettyRpcClientConfigHelper method getDefaultEventLoopConfig.

private static Pair<EventLoopGroup, Class<? extends Channel>> getDefaultEventLoopConfig(Configuration conf) {
    Pair<EventLoopGroup, Class<? extends Channel>> eventLoop = DEFAULT_EVENT_LOOP;
    if (eventLoop != null) {
        return eventLoop;
    }
    synchronized (NettyRpcClientConfigHelper.class) {
        eventLoop = DEFAULT_EVENT_LOOP;
        if (eventLoop != null) {
            return eventLoop;
        }
        int threadCount = conf.getInt(HBASE_NETTY_EVENTLOOP_RPCCLIENT_THREADCOUNT_KEY, 0);
        eventLoop = new Pair<>(new NioEventLoopGroup(threadCount, new DefaultThreadFactory("RPCClient-NioEventLoopGroup", true, Thread.NORM_PRIORITY)), NioSocketChannel.class);
        DEFAULT_EVENT_LOOP = eventLoop;
    }
    return eventLoop;
}
Also used : DefaultThreadFactory(org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultThreadFactory) NioSocketChannel(org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel) EventLoopGroup(org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup) NioEventLoopGroup(org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoopGroup) Channel(org.apache.hbase.thirdparty.io.netty.channel.Channel) NioSocketChannel(org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel) NioEventLoopGroup(org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoopGroup)

Aggregations

Channel (org.apache.hbase.thirdparty.io.netty.channel.Channel)7 IOException (java.io.IOException)5 DatanodeInfo (org.apache.hadoop.hdfs.protocol.DatanodeInfo)3 ChannelFuture (org.apache.hbase.thirdparty.io.netty.channel.ChannelFuture)3 NioSocketChannel (org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel)3 InterruptedIOException (java.io.InterruptedIOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ArrayList (java.util.ArrayList)2 ExecutionException (java.util.concurrent.ExecutionException)2 UnresolvedLinkException (org.apache.hadoop.fs.UnresolvedLinkException)2 InvalidBlockTokenException (org.apache.hadoop.hdfs.security.token.block.InvalidBlockTokenException)2 LeaseExpiredException (org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException)2 RemoteException (org.apache.hadoop.ipc.RemoteException)2 Bootstrap (org.apache.hbase.thirdparty.io.netty.bootstrap.Bootstrap)2 ChannelFutureListener (org.apache.hbase.thirdparty.io.netty.channel.ChannelFutureListener)2 Future (org.apache.hbase.thirdparty.io.netty.util.concurrent.Future)2 InetSocketAddress (java.net.InetSocketAddress)1 UnknownHostException (java.net.UnknownHostException)1 HashSet (java.util.HashSet)1 IdentityHashMap (java.util.IdentityHashMap)1