Class SCPResultMessage

java.lang.Object
uk.ac.manchester.spinnaker.messages.scp.SCPResultMessage

public final class SCPResultMessage
extends Object
The low-level format of SCP result message.
  • Constructor Details

    • SCPResultMessage

      public SCPResultMessage​(ByteBuffer response)
      Parameters:
      response - The payload of the UDP message, which must be an SDP message without header stripped.
  • Method Details

    • isRetriable

      public boolean isRetriable()
      Returns:
      Whether this response indicates that the request should be retried.
    • pickRequest

      public <T> T pickRequest​(Map<Integer,​T> requestStore)
      Given a collection of requests, pick the one that correlates to this result.
      Type Parameters:
      T - The type of requests.
      Parameters:
      requestStore - The store of requests.
      Returns:
      The correlated request, or null if no correlation exists.
    • removeRequest

      public void removeRequest​(Map<Integer,​?> requestStore)
      Given a collection of requests, remove the one that correlates to this result.
      Parameters:
      requestStore - The store of requests.
    • parsePayload

      public <T extends SCPResponse> T parsePayload​(SCPRequest<T> request) throws Exception
      Parse the payload data of the data into something higher level. Note that it is assumed that the caller has already done the sequence number matching (or has good reasons to not do so).
      Type Parameters:
      T - The type of response associated with the request.
      Parameters:
      request - The request that this class was a response to.
      Returns:
      The response, assuming it was successful.
      Throws:
      Exception - If anything goes wrong with result code checking or deserialization.
      IllegalStateException - If the response has already been parsed.
    • getResult

      public SCPResult getResult()
      Returns:
      The result code from the header.
    • getSequenceNumber

      public int getSequenceNumber()
      Returns:
      The sequence number from the header.
    • toString

      public String toString()
      Overrides:
      toString in class Object