Class MessageHandler

java.lang.Object
org.metricshub.ipmi.core.connection.MessageHandler
Direct Known Subclasses:
IpmiMessageHandler, SolMessageHandler

public abstract class MessageHandler extends Object
Class used for handling outgoing and incoming messages for a Connection.
  • Constructor Details

    • MessageHandler

      public MessageHandler(Connection connection, int timeout, int minSequenceNumber, int maxSequenceNumber)
  • Method Details

    • sendMessage

      public int sendMessage(PayloadCoder payloadCoder, StateMachine stateMachine, int sessionId, boolean isOneWay) throws ConnectionException
      Attempts to send message encoded by given PayloadCoder to the remote system.
      Parameters:
      payloadCoder - instance of PayloadCoder that will produce payload for the message being sent.
      stateMachine - StateMachine for the currenr connection.
      sessionId - ID of the current session.
      isOneWay - flag indicating, if message is one way and we shouldn't await response, or it isn't and needs response from remote system
      Returns:
      sequence number of the sent message
      Throws:
      ConnectionException - when could not send message due to some problems with connection
    • retryMessage

      public int retryMessage(int tag, StateMachine stateMachine, int sessionId) throws ConnectionException
      Attempts to retry sending message with given tag, assuming that this message exists in message queue.
      Parameters:
      tag - tag of the message that we want to resend
      stateMachine - StateMachine for the currenr connection.
      sessionId - ID of the current session.
      Returns:
      sequence number of the retried message (should be the same as original message tag) or -1 if no message was found in the queue.
      Throws:
      ConnectionException - when could not send message due to some problems with connection
    • handleIncomingMessage

      public void handleIncomingMessage(Ipmiv20Message message)
      Checks if received message is inside "sliding window range", and if it is, further processes the message in a cimplementation-specific way.
      Parameters:
      message -
    • setTimeout

      public void setTimeout(int timeout)
    • tearDown

      public void tearDown()
    • getSequenceNumber

      public int getSequenceNumber()