Package org.simpleframework.transport
Class TransportDispatcher
java.lang.Object
org.simpleframework.transport.TransportDispatcher
The
TransportDispatcher
operation is used transfer a
transport to the processor so it can be processed. This is used so
that when a transport is given to the processor it can be dispatched
in another thread to the processor. This is needed so that the
connection thread is occupied only briefly.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TransportProcessor
This is the processor used to transfer the transport to.private final Transport
This is the transport to be passed to the processor. -
Constructor Summary
ConstructorsConstructorDescriptionTransportDispatcher
(TransportProcessor processor, Transport transport) Constructor for theTransportDispatcher
object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
This is used to cancel the operation if it has timed out.This is theSelectableChannel
which is used to determine if the operation should be executed.getTrace()
This is used to acquire the trace object that is associated with the operation.void
run()
This is used to transfer the transport to the processor.
-
Field Details
-
processor
This is the processor used to transfer the transport to. -
transport
This is the transport to be passed to the processor.
-
-
Constructor Details
-
TransportDispatcher
Constructor for theTransportDispatcher
object. This is used to transfer a transport to a processor. Transferring the transport using an operation ensures that the thread that is used to process the transport is not occupied for long.- Parameters:
processor
- this is the negotiation to dispatch totransport
- this is the transport this exchange uses
-
-
Method Details
-
getChannel
This is theSelectableChannel
which is used to determine if the operation should be executed. If the channel is ready for a given I/O event it can be run. For instance if the operation is used to perform some form of read operation it can be executed when ready to read data from the channel.- Specified by:
getChannel
in interfaceOperation
- Returns:
- this returns the channel used to govern execution
-
getTrace
This is used to acquire the trace object that is associated with the operation. A trace object is used to collection details on what operations are being performed. For instance it may contain information relating to I/O events or errors. -
run
public void run()This is used to transfer the transport to the processor. This will typically be executed asynchronously so that it does not delay the thread that passes theTransport
to the transport processor, ensuring quicker processing. -
cancel
public void cancel()This is used to cancel the operation if it has timed out. This is typically invoked when it has been waiting in a selector for an extended duration of time without any active operations on it. In such a case the reactor must purge the operation to free the memory and open channels associated with the operation.
-