@ThreadSafe public final class NettyUtils extends Object
Modifier and Type | Method and Description |
---|---|
static io.netty.channel.EventLoopGroup |
createEventLoop(ChannelType type,
int numThreads,
String threadPrefix,
boolean isDaemon)
Creates a Netty
EventLoopGroup based on ChannelType . |
static Class<? extends io.netty.channel.Channel> |
getChannelClass(boolean isDomainSocket,
PropertyKey key,
AlluxioConfiguration conf)
Get the proper channel class.
|
static ChannelType |
getChannelType(PropertyKey key,
AlluxioConfiguration conf)
Get the proper channel type.
|
static Class<? extends io.netty.channel.ServerChannel> |
getServerChannelClass(boolean isDomainSocket,
AlluxioConfiguration conf)
Returns the correct
ServerSocketChannel class for use by the
worker. |
static ChannelType |
getUserChannel(AlluxioConfiguration conf)
Gets the ChannelType properly from the USER_NETWORK_NETTY_CHANNEL property key.
|
static ChannelType |
getWorkerChannel(AlluxioConfiguration conf)
Gets the worker channel properly from the WORKER_NETWORK_NETTY_CHANNEL property key.
|
static boolean |
isDomainSocketAccessible(WorkerNetAddress workerNetAddress,
AlluxioConfiguration conf) |
static boolean |
isDomainSocketSupported(WorkerNetAddress workerNetAddress) |
static boolean |
isNettyEpollAvailable() |
public static io.netty.channel.EventLoopGroup createEventLoop(ChannelType type, int numThreads, String threadPrefix, boolean isDaemon)
EventLoopGroup
based on ChannelType
.type
- Selector for which form of low-level IO we should usenumThreads
- target number of threadsthreadPrefix
- name pattern for each thread. should contain '%d' to distinguish between
threads.isDaemon
- if true, the ThreadFactory
will create daemon
threads.public static Class<? extends io.netty.channel.ServerChannel> getServerChannelClass(boolean isDomainSocket, AlluxioConfiguration conf)
ServerSocketChannel
class for use by the
worker.isDomainSocket
- whether this is a domain socket serverconf
- Alluxio configurationpublic static boolean isDomainSocketAccessible(WorkerNetAddress workerNetAddress, AlluxioConfiguration conf)
workerNetAddress
- the worker addressconf
- Alluxio configurationpublic static boolean isDomainSocketSupported(WorkerNetAddress workerNetAddress)
workerNetAddress
- the worker addresspublic static boolean isNettyEpollAvailable()
public static ChannelType getUserChannel(AlluxioConfiguration conf)
conf
- Alluxio configurationpublic static ChannelType getWorkerChannel(AlluxioConfiguration conf)
conf
- Alluxio configurationpublic static Class<? extends io.netty.channel.Channel> getChannelClass(boolean isDomainSocket, PropertyKey key, AlluxioConfiguration conf)
NioSocketChannel
NIO if EPOLL is not available.isDomainSocket
- whether this is for a domain channelkey
- the property key for looking up the configured channel typeconf
- the Alluxio configurationpublic static ChannelType getChannelType(PropertyKey key, AlluxioConfiguration conf)
ChannelType
NIO if EPOLL is not available.key
- the property key for looking up the configured channel typeconf
- the Alluxio configurationCopyright © 2023. All Rights Reserved.