Interface CommandTransport.CommandReceiver

Enclosing class:
CommandTransport

protected static interface CommandTransport.CommandReceiver
SPI implemented by Channel so that the transport can pass the received command to Channel for processing.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Notifies the channel that a new Command was received from the other side.
    void
    Indicates that the transport has encountered a problem.
  • Method Details

    • handle

      void handle(Command cmd)
      Notifies the channel that a new Command was received from the other side.

      Channel performs all the error recovery of the error resulting from the command invocation. Channel implements this method in a non-reentrant fashion; a transport can invoke this method from different threads, but as the class javadoc states, the transport must guarantee in-order delivery of the commands, and that means you cannot call this method concurrently.

      Parameters:
      cmd - The command received. This object must be read from the payload using Command.readFrom(Channel, byte[]).
    • terminate

      void terminate(IOException e)
      Indicates that the transport has encountered a problem. This tells the channel that it shouldn't expect future invocation of handle(Command), and it'll abort the communication.