Class CommandTransport

    • Constructor Detail

      • CommandTransport

        protected CommandTransport()
    • Method Detail

      • getRemoteCapability

        public abstract Capability getRemoteCapability()
                                                throws IOException
        Abstraction of the connection hand-shaking.

        Before two channels can talk to each other,

        Throws:
        IOException
      • write

        public abstract void write​(Command cmd,
                                   boolean last)
                            throws IOException
        Called by Channel to send one command to the other side. Channel serializes the invocation of this method for ordering. That is, at any given point in time only one thread executes this method.

        Asynchronous transport must serialize the given command object before returning from this method, as its content can be modified by the calling thread as soon as this method returns. Also, if an asynchronous transport chooses to return from this method without committing data to the network, then it is also responsible for a flow control (by blocking this method if too many commands are queueing up waiting for the network to unclog.)

        Parameters:
        cmd - The command object that needs to be sent. Never null. This must be serialized via Command.writeTo(Channel, ObjectOutputStream)
        last - Informational flag that indicates that this is the last call of the write(Command, boolean).
        Throws:
        IOException
      • closeWrite

        public abstract void closeWrite()
                                 throws IOException
        Called to close the write side of the transport, allowing the underlying transport to be shut down.

        If the Channel aborts the communication, this method may end up invoked asynchronously, concurrently, and multiple times. The implementation must protect against that.

        Throws:
        IOException
      • closeRead

        public abstract void closeRead()
                                throws IOException
        Called to indicate that the no further input is expected and any resources associated with reading commands should be freed. Channel.isInClosed() can be also used to test if the command reading should terminate.
        Throws:
        IOException