Class TransportDispatcher

  • All Implemented Interfaces:
    java.lang.Runnable, Operation

    class TransportDispatcher
    extends java.lang.Object
    implements Operation
    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

      Fields 
      Modifier and Type Field Description
      private TransportProcessor processor
      This is the processor used to transfer the transport to.
      private Transport transport
      This is the transport to be passed to the processor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()
      This is used to cancel the operation if it has timed out.
      java.nio.channels.SocketChannel getChannel()
      This is the SelectableChannel which is used to determine if the operation should be executed.
      Trace 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • processor

        private final TransportProcessor processor
        This is the processor used to transfer the transport to.
      • transport

        private final Transport transport
        This is the transport to be passed to the processor.
    • Constructor Detail

      • TransportDispatcher

        public TransportDispatcher​(TransportProcessor processor,
                                   Transport transport)
        Constructor for the TransportDispatcher 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:
        transport - this is the transport this exchange uses
        processor - this is the negotiation to dispatch to
    • Method Detail

      • getChannel

        public java.nio.channels.SocketChannel getChannel()
        This is the SelectableChannel 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 interface Operation
        Returns:
        this returns the channel used to govern execution
      • getTrace

        public Trace 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.
        Specified by:
        getTrace in interface Operation
        Returns:
        this returns the trace associated with this operation
      • 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 the Transport to the transport processor, ensuring quicker processing.
        Specified by:
        run in interface java.lang.Runnable
      • 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.
        Specified by:
        cancel in interface Operation