@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 void |
disableAutoRead(io.netty.channel.Channel channel)
Disables auto read for a netty channel.
|
static void |
enableAutoRead(io.netty.channel.Channel channel)
Enables auto read for a netty channel.
|
static Class<? extends io.netty.channel.Channel> |
getClientChannelClass(boolean isDomainSocket,
AlluxioConfiguration conf)
Returns the correct
SocketChannel class for use by the client. |
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 Class<? extends io.netty.channel.Channel> getClientChannelClass(boolean isDomainSocket, AlluxioConfiguration conf)
SocketChannel
class for use by the client.isDomainSocket
- whether this is to connect to a domain socket serverconf
- Alluxio configurationpublic static void enableAutoRead(io.netty.channel.Channel channel)
channel
- the netty channelpublic static void disableAutoRead(io.netty.channel.Channel channel)
channel
- the netty channelpublic 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 configurationCopyright © 2023. All Rights Reserved.