Search in sources :

Example 1 with DefaultThreadFactory

use of org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultThreadFactory 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)1 EventLoopGroup (org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup)1 NioEventLoopGroup (org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoopGroup)1 NioSocketChannel (org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel)1 DefaultThreadFactory (org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultThreadFactory)1