Package org.simpleframework.transport
Class ServerCleaner
java.lang.Object
org.simpleframework.common.thread.Daemon
org.simpleframework.transport.ServerCleaner
- All Implemented Interfaces:
Runnable
The
ServerCleaner
object allows for the termination
and resource recovery to be done asynchronously. This ensures that
should a HTTP request be used to terminate the processor that it
does not block waiting for the servicing thread pool to terminate
causing a deadlock.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentExecutor
This is the thread pool implementation used by the server.private final TransportProcessor
This is the internal processor that is to be terminated.private final Reactor
This is the internal write reactor that is terminated. -
Constructor Summary
ConstructorsConstructorDescriptionServerCleaner
(TransportProcessor processor, ConcurrentExecutor executor, Reactor reactor) Constructor for theServerCleaner
object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
When this method runs it will firstly stop the processor in a synchronous fashion.
-
Field Details
-
processor
This is the internal processor that is to be terminated. -
executor
This is the thread pool implementation used by the server. -
reactor
This is the internal write reactor that is terminated.
-
-
Constructor Details
-
ServerCleaner
Constructor for theServerCleaner
object. For an orderly termination of the processor, the processor and reactor provided to the constructor will be stopped asynchronously.- Parameters:
processor
- this is the processor that is to be stoppedexecutor
- this is the executor used by the serverreactor
- this is the reactor that is to be closed
-
-
Method Details
-
run
public void run()When this method runs it will firstly stop the processor in a synchronous fashion. Once theTransportProcessor
has stopped it will stop theReactor
ensuring that all threads will be released.It is important to note that stopping the processor before stopping the reactor is required. This ensures that if there are any threads executing within the processor that require the reactor threads, they can complete without a problem.
-