Class ConcurrentServerRunner<T extends Client>

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.net.server.ConcurrentServerRunner<T>
All Implemented Interfaces:
ServerRunner<T>, ContextAware, Runnable

public abstract class ConcurrentServerRunner<T extends Client> extends ContextAwareBase implements Runnable, ServerRunner<T>
A concurrent ServerRunner.

An instance of this object is created with a ServerListener and an Executor. On invocation of the start() method, it passes itself to the given Executor and returns immediately. On invocation of its run() method by the Executor it begins accepting client connections via its ServerListener. As each new Client is accepted, the client is configured with the runner's LoggingContext and is then passed to the Executor for concurrent execution of the client's service loop.

On invocation of the stop() method, the runner closes the listener and each of the connected clients (by invoking Client.close() effectively interrupting any blocked I/O calls and causing these concurrent subtasks to exit gracefully). This ensures that before the stop() method returns (1) all I/O resources have been released and (2) all of the threads of the Executor are idle.

Author:
Carl Harris