Class AbstractByteBufferCommandTransport

    • Constructor Detail

      • AbstractByteBufferCommandTransport

        public AbstractByteBufferCommandTransport()
    • Method Detail

      • write

        protected abstract void write​(ByteBuffer header,
                                      ByteBuffer data)
                               throws IOException
        Write the packet.
        header - the header to write.
        data - the data to write.
        IOException - if the data could not be written.
      • setFrameSize

        public void setFrameSize​(int transportFrameSize)
        Set the frame size.
        transportFrameSize - the new frame size (must be in the range 1-Short.MAX_VALUE).
      • getChannel

        protected Channel getChannel()
        Gets the channel.
        the channel.
      • write

        public final 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.)

        Specified by:
        write in class CommandTransport
        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 CommandTransport.write(Command, boolean).
      • terminate

        public void terminate​(IOException e)
        Indicates that the endpoint has encountered a problem. This tells the transport that it shouldn't expect future invocation of receive(ByteBuffer), and it'll abort the communication.