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:
parent
ae1bf5fbdd
commit
dde9211702
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user