Add one new constructor with ThreadFactory / Executor only

Motivation:
In most cases, we want to use MultithreadEventLoopGroup without setting thread numbers but thread name only. We should simplify this for the user

Modifications:
Add a new constructor

Result:
User can only set ThreadFactory / Executor without setting the thread number to 0:
This commit is contained in:
Norman Maurer 2019-11-18 10:01:19 +01:00
parent ae1bf5fbdd
commit dde9211702
1 changed files with 29 additions and 0 deletions

View File

@ -105,6 +105,35 @@ public class MultithreadEventLoopGroup extends MultithreadEventExecutorGroup imp
SingleThreadEventLoop.DEFAULT_MAX_PENDING_TASKS, RejectedExecutionHandlers.reject());
}
/**
* Create a new instance.
*
* @param executor the {@link Executor} to use, or {@code null} if the default should be used.
* @param ioHandlerFactory the {@link IoHandlerFactory} to use for creating new
* {@link IoHandler} instances that will handle the IO for the
* {@link EventLoop}.
*/
public MultithreadEventLoopGroup(Executor executor,
IoHandlerFactory ioHandlerFactory) {
this(0, executor, ioHandlerFactory,
SingleThreadEventLoop.DEFAULT_MAX_PENDING_TASKS, RejectedExecutionHandlers.reject(),
SingleThreadEventLoop.DEFAULT_MAX_TASKS_PER_RUN);
}
/**
* Create a new instance.
*
* @param threadFactory the {@link ThreadFactory} to use, or {@code null} if the default should be used.
* @param ioHandlerFactory the {@link IoHandlerFactory} to use for creating new
* {@link IoHandler} instances that will handle the IO for the
* {@link EventLoop}.
*/
public MultithreadEventLoopGroup(ThreadFactory threadFactory,
IoHandlerFactory ioHandlerFactory) {
this(0, threadFactory, ioHandlerFactory,
SingleThreadEventLoop.DEFAULT_MAX_PENDING_TASKS, RejectedExecutionHandlers.reject());
}
/**
* Create a new instance.
*