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);
}
}
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;
}
Aggregations