Threads Module User's Guide : PART II Concurrency Packages : Chapter 3 The Threading Package : The Server Classes
The Server Classes
As explained in “Runnable Servers” a runnable server is a threaded runnable that accepts and queues any number of runnable objects and executes them within its own internal thread or threads.
The runnable server classes include:
RWRunnableServer —A threaded runnable that accepts runnable objects and executes them using its own, internal thread. An application using an RWRunnableServer will contain at least two threads: the main thread that created the RWRunnableServer, and the thread that is running the RWRunnableServer do-loop.
The RWRunnableServer do-loop performs the following operations until a termination condition (cancellation or stop) occurs:
Get the next available runnable (may block).
Check for a termination condition.
Execute the runnable.
RWServerPool — A threaded runnable that accepts runnable objects and dispatches each one to the next available RWRunnableServer object from an internal pool of such objects. An application containing an RWServerPool will contain at least 2 + n threads: the main thread that created the RWServerPool, the thread that is running the RWServerPool do-loop, and n RWRunnableServer threads each executing the do-loop of an RWRunnableServer in the RWServerPool's internal queue.
The RWServerPool do-loop performs the following operations until a termination condition (cancellation or stop) occurs:
Get the next available runnable (may block).
Check for a termination condition.
Get the next available runnable server (may block).
Check for a termination condition.
Enqueue the runnable on the runnable server.