Package org.simpleframework.transport
Class ServerCleaner
- java.lang.Object
-
- org.simpleframework.common.thread.Daemon
-
- org.simpleframework.transport.ServerCleaner
-
- All Implemented Interfaces:
java.lang.Runnable
class ServerCleaner extends Daemon
TheServerCleaner
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
Fields Modifier and Type Field Description private ConcurrentExecutor
executor
This is the thread pool implementation used by the server.private TransportProcessor
processor
This is the internal processor that is to be terminated.private Reactor
reactor
This is the internal write reactor that is terminated.
-
Constructor Summary
Constructors Constructor Description ServerCleaner(TransportProcessor processor, ConcurrentExecutor executor, Reactor reactor)
Constructor for theServerCleaner
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
run()
When this method runs it will firstly stop the processor in a synchronous fashion.
-
-
-
Field Detail
-
processor
private final TransportProcessor processor
This is the internal processor that is to be terminated.
-
executor
private final ConcurrentExecutor executor
This is the thread pool implementation used by the server.
-
reactor
private final Reactor reactor
This is the internal write reactor that is terminated.
-
-
Constructor Detail
-
ServerCleaner
public ServerCleaner(TransportProcessor processor, ConcurrentExecutor executor, Reactor reactor)
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 Detail
-
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.
-
-