Search in sources :

Example 1 with EventLoopGroup

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

the class AsyncFSWALProvider method createAsyncWriter.

/**
 * Public because of AsyncFSWAL. Should be package-private
 */
public static AsyncWriter createAsyncWriter(Configuration conf, FileSystem fs, Path path, boolean overwritable, long blocksize, EventLoopGroup eventLoopGroup, Class<? extends Channel> channelClass, StreamSlowMonitor monitor) throws IOException {
    // Configuration already does caching for the Class lookup.
    Class<? extends AsyncWriter> logWriterClass = conf.getClass(WRITER_IMPL, AsyncProtobufLogWriter.class, AsyncWriter.class);
    try {
        AsyncWriter writer = logWriterClass.getConstructor(EventLoopGroup.class, Class.class).newInstance(eventLoopGroup, channelClass);
        writer.init(fs, path, conf, overwritable, blocksize, monitor);
        return writer;
    } catch (Exception e) {
        if (e instanceof CommonFSUtils.StreamLacksCapabilityException) {
            LOG.error("The RegionServer async write ahead log provider " + "relies on the ability to call " + e.getMessage() + " for proper operation during " + "component failures, but the current FileSystem does not support doing so. Please " + "check the config value of '" + CommonFSUtils.HBASE_WAL_DIR + "' and ensure " + "it points to a FileSystem mount that has suitable capabilities for output streams.");
        } else {
            LOG.debug("Error instantiating log writer.", e);
        }
        Throwables.propagateIfPossible(e, IOException.class);
        throw new IOException("cannot get log writer", e);
    }
}
Also used : EventLoopGroup(org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup) CommonFSUtils(org.apache.hadoop.hbase.util.CommonFSUtils) IOException(java.io.IOException) StreamLacksCapabilityException(org.apache.hadoop.hbase.util.CommonFSUtils.StreamLacksCapabilityException) IOException(java.io.IOException) StreamLacksCapabilityException(org.apache.hadoop.hbase.util.CommonFSUtils.StreamLacksCapabilityException)

Example 2 with EventLoopGroup

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

EventLoopGroup (org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup)2 IOException (java.io.IOException)1 CommonFSUtils (org.apache.hadoop.hbase.util.CommonFSUtils)1 StreamLacksCapabilityException (org.apache.hadoop.hbase.util.CommonFSUtils.StreamLacksCapabilityException)1 Channel (org.apache.hbase.thirdparty.io.netty.channel.Channel)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