Class ConcurrentServerRunner<T extends Client>
- All Implemented Interfaces:
ServerRunner<T>
,ContextAware
,Runnable
ServerRunner
.
An instance of this object is created with a ServerListener
and
an Executor
. On invocation of the
invalid reference
#start()
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
invalid reference
LoggingContext
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.
-
Constructor Summary
ConstructorsConstructorDescriptionConcurrentServerRunner
(ServerListener<T> listener, Executor executor) Deprecated.Constructs a new server runner. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ClientVisitor<T> visitor) Deprecated.Presents each connected client to the given visitor.boolean
Deprecated.Gets a flag indicating whether the server is currently running.void
run()
Deprecated.void
stop()
Deprecated.Stops execution of the runner.Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getStatusManager, setContext
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
ConcurrentServerRunner
Deprecated.Constructs a new server runner.- Parameters:
listener
- the listener from which the server will accept new clientsexecutor
- a executor that will facilitate execution of the listening and client-handling tasks; while anyExecutor
is allowed here, outside of unit testing the only reasonable choice is a bounded thread pool of some kind.
-
-
Method Details
-
isRunning
public boolean isRunning()Deprecated.Gets a flag indicating whether the server is currently running.- Specified by:
isRunning
in interfaceServerRunner<T extends Client>
- Returns:
- flag state
-
stop
Deprecated.Stops execution of the runner.This method must cause all I/O and thread resources associated with the runner to be released. If the receiver has not been started, this method must have no effect.
- Specified by:
stop
in interfaceServerRunner<T extends Client>
- Throws:
IOException
-
accept
Deprecated.Presents each connected client to the given visitor.- Specified by:
accept
in interfaceServerRunner<T extends Client>
- Parameters:
visitor
- the subject visitor
-
run
public void run()Deprecated.
-