Package org.ldaptive.transport.netty
Class NettyUtils
- java.lang.Object
-
- org.ldaptive.transport.netty.NettyUtils
-
final class NettyUtils extends Object
Provides utility methods for this package.
-
-
Field Summary
Fields Modifier and Type Field Description private static long
DEFAULT_SHUTDOWN_MAX_TIMEOUT
Time in milliseconds for graceful shutdown max wait.private static long
DEFAULT_SHUTDOWN_QUIET_PERIOD
Time in milliseconds for graceful shutdown quiet period.private static boolean
EPOLL_AVAILABLE
Whether Epoll is available.private static boolean
KQUEUE_AVAILABLE
Whether KQueue is available.private static Logger
LOGGER
Logger for this class.private static boolean
USE_NIO
Whether to use NIO even if other transports are available.
-
Constructor Summary
Constructors Modifier Constructor Description private
NettyUtils()
Default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.netty.channel.EventLoopGroup
createDefaultEventLoopGroup(String name, int numThreads)
Returns the default event loop group for this platform.static Class<? extends io.netty.channel.Channel>
getDefaultSocketChannelType()
Returns the default socket channel type for this platform.static void
shutdownGracefully(io.netty.channel.EventLoopGroup workerGroup)
InvokesEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
on the supplied worker group.
-
-
-
Field Detail
-
DEFAULT_SHUTDOWN_QUIET_PERIOD
private static final long DEFAULT_SHUTDOWN_QUIET_PERIOD
Time in milliseconds for graceful shutdown quiet period.- See Also:
- Constant Field Values
-
DEFAULT_SHUTDOWN_MAX_TIMEOUT
private static final long DEFAULT_SHUTDOWN_MAX_TIMEOUT
Time in milliseconds for graceful shutdown max wait.- See Also:
- Constant Field Values
-
USE_NIO
private static final boolean USE_NIO
Whether to use NIO even if other transports are available.
-
EPOLL_AVAILABLE
private static final boolean EPOLL_AVAILABLE
Whether Epoll is available.
-
KQUEUE_AVAILABLE
private static final boolean KQUEUE_AVAILABLE
Whether KQueue is available.
-
LOGGER
private static final Logger LOGGER
Logger for this class.
-
-
Method Detail
-
getDefaultSocketChannelType
public static Class<? extends io.netty.channel.Channel> getDefaultSocketChannelType()
Returns the default socket channel type for this platform. SeeEpoll.isAvailable()
andKQueue.isAvailable()
.- Returns:
- socket channel type
-
createDefaultEventLoopGroup
public static io.netty.channel.EventLoopGroup createDefaultEventLoopGroup(String name, int numThreads)
Returns the default event loop group for this platform. SeeEpoll.isAvailable()
andKQueue.isAvailable()
. Set numThreads to zero to use the netty default.- Parameters:
name
- of the thread poolnumThreads
- number of threads in the thread pool- Returns:
- event loop group
-
shutdownGracefully
public static void shutdownGracefully(io.netty.channel.EventLoopGroup workerGroup)
InvokesEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
on the supplied worker group. This method blocks for twice theDEFAULT_SHUTDOWN_MAX_TIMEOUT
waiting for the shutdown to be done. If the future is not invoked in that timeframe a warning is logged.- Parameters:
workerGroup
- to shutdown
-
-