public class DefaultEventLoopGroupProvider extends Object implements EventLoopGroupProvider
| Modifier and Type | Field and Description |
|---|---|
protected static io.netty.util.internal.logging.InternalLogger |
logger |
| Constructor and Description |
|---|
DefaultEventLoopGroupProvider(int numberOfThreads)
Creates a new instance of
DefaultEventLoopGroupProvider. |
| Modifier and Type | Method and Description |
|---|---|
<T extends EventLoopGroup> |
allocate(Class<T> type)
|
static <T extends EventExecutorGroup> |
createEventLoopGroup(Class<T> type,
int numberOfThreads)
Create an instance of a
EventExecutorGroup. |
Promise<Boolean> |
release(EventExecutorGroup eventLoopGroup,
long quietPeriod,
long timeout,
TimeUnit unit)
Release a
eventLoopGroup instance. |
Future<Boolean> |
shutdown(long quietPeriod,
long timeout,
TimeUnit timeUnit)
Shutdown the provider and release all instances.
|
int |
threadPoolSize()
Returns the pool size (number of threads) for IO threads.
|
protected static final io.netty.util.internal.logging.InternalLogger logger
public DefaultEventLoopGroupProvider(int numberOfThreads)
DefaultEventLoopGroupProvider.numberOfThreads - number of threads (pool size)public <T extends EventLoopGroup> T allocate(Class<T> type)
EventLoopGroupProviderEventLoopGroup for the channel type. Do not terminate or shutdown the
instance. Call the EventLoopGroupProvider.release(EventExecutorGroup, long, long, TimeUnit) to release an individual instance or
EventLoopGroupProvider.shutdown(long, long, TimeUnit) method to free the all resources.allocate in interface EventLoopGroupProviderT - type of the EventLoopGrouptype - class of the EventLoopGroup, must not be nullEventLoopGroup.public static <T extends EventExecutorGroup> EventExecutorGroup createEventLoopGroup(Class<T> type, int numberOfThreads)
EventExecutorGroup. Supported types are:
T - type parametertype - the typenumberOfThreads - the number of threads to use for the EventExecutorGroupEventExecutorGroupIllegalArgumentException - if the type is not supported.public Promise<Boolean> release(EventExecutorGroup eventLoopGroup, long quietPeriod, long timeout, TimeUnit unit)
EventLoopGroupProvidereventLoopGroup instance. The method will shutdown/terminate the EventExecutorGroup if it is no longer
needed.release in interface EventLoopGroupProvidereventLoopGroup - the eventLoopGroup instance, must not be nullquietPeriod - the quiet periodtimeout - the timeoutunit - time unit for the quiet period/the timeoutpublic int threadPoolSize()
EventLoopGroupProviderthreadPoolSize in interface EventLoopGroupProviderpublic Future<Boolean> shutdown(long quietPeriod, long timeout, TimeUnit timeUnit)
EventLoopGroupProvidershutdown in interface EventLoopGroupProviderquietPeriod - the quiet periodtimeout - the timeouttimeUnit - the unit of quietPeriod and timeoutCopyright © 2019 lettuce.io. All rights reserved.