public final class DefaultExecutorServiceFactory extends Object implements ExecutorServiceFactory
ExecutorServiceFactory
that creates a new ForkJoinPool
on each
call to newExecutorService(int)
.
This ExecutorServiceFactory
powers Netty's nio and epoll eventloops by default. Netty moved from managing its
own threads and pinning a thread to each eventloop to an Executor
-based approach. That way advanced
users of Netty can plug in their own threadpools and gain more control of scheduling the eventloops.
The main reason behind choosing a ForkJoinPool
as the default Executor
is that it uses
thread-local task queues, providing a high level of thread affinity to Netty's eventloops.
The whole discussion can be found on GitHub https://github.com/netty/netty/issues/2250.
Constructor and Description |
---|
DefaultExecutorServiceFactory(Class<?> clazzNamePrefix) |
DefaultExecutorServiceFactory(String namePrefix) |
public DefaultExecutorServiceFactory(Class<?> clazzNamePrefix)
clazzNamePrefix
- the name of the class will be used to prefix the name of each
ForkJoinWorkerThread
with.public DefaultExecutorServiceFactory(String namePrefix)
namePrefix
- the string to prefix the name of each ForkJoinWorkerThread
with.public ExecutorService newExecutorService(int parallelism)
newExecutorService
in interface ExecutorServiceFactory
Copyright © 2008–2015 The Netty Project. All rights reserved.