WorkerService is a worker thread pool for running tasks and is implemented
using one or more ExecutorServices. A WorkerService can support assignable
threads, which it does by creating N separate single thread ExecutorServices,
or non-assignable threads, which it does by creating a single N-thread
- NIOServerCnxnFactory uses a non-assignable WorkerService because the
socket IO requests are order independent and allowing the
ExecutorService to handle thread assignment gives optimal performance.
- CommitProcessor uses an assignable WorkerService because requests for
a given session must be processed in order.
ExecutorService provides queue management and thread restarting, so it's
useful even with a single thread.
Schedule work to be done. If a worker thread pool is not being
used, work is done directly by this thread. This schedule API is
for use with non-assignable WorkerServices. For assignable
WorkerServices, will always run on the first thread.
Schedule work to be done by the thread assigned to this id. Thread
assignment is a single mod operation on the number of threads. If a
worker thread pool is not being used, work is done directly by