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,java.lang.Runnable
@Deprecated(since="2022-01-27") public abstract class ConcurrentServerRunner<T extends Client> extends ContextAwareBase implements java.lang.Runnable, ServerRunner<T>
Deprecated.This internal logback API is not supported by AEM as a Cloud Service.A concurrentServerRunner.An instance of this object is created with a
ServerListenerand anExecutor. On invocation of the#start()method, it passes itself to the givenExecutorand returns immediately. On invocation of itsrun()method by theExecutorit begins accepting client connections via itsServerListener. As each newClientis accepted, the client is configured with the runner'sLoggingContextand is then passed to theExecutorfor 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 invokingClient.close()effectively interrupting any blocked I/O calls and causing these concurrent subtasks to exit gracefully). This ensures that before thestop()method returns (1) all I/O resources have been released and (2) all of the threads of theExecutorare idle.
-
-
Constructor Summary
Constructors Constructor Description ConcurrentServerRunner(ServerListener<T> listener, java.util.concurrent.Executor executor)Deprecated.Constructs a new server runner.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(ClientVisitor<T> visitor)Deprecated.Presents each connected client to the given visitor.booleanisRunning()Deprecated.Gets a flag indicating whether the server is currently running.voidrun()Deprecated.voidstop()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 Detail
-
ConcurrentServerRunner
public ConcurrentServerRunner(ServerListener<T> listener, java.util.concurrent.Executor executor)
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 anyExecutoris allowed here, outside of unit testing the only reasonable choice is a bounded thread pool of some kind.
-
-
Method Detail
-
isRunning
public boolean isRunning()
Deprecated.Gets a flag indicating whether the server is currently running.- Specified by:
isRunningin interfaceServerRunner<T extends Client>- Returns:
- flag state
-
stop
public void stop() throws java.io.IOExceptionDeprecated.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:
stopin interfaceServerRunner<T extends Client>- Throws:
java.io.IOException
-
accept
public void accept(ClientVisitor<T> visitor)
Deprecated.Presents each connected client to the given visitor.- Specified by:
acceptin interfaceServerRunner<T extends Client>- Parameters:
visitor- the subject visitor
-
run
public void run()
Deprecated.- Specified by:
runin interfacejava.lang.Runnable
-
-