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 Summary
Constructors Constructor Description SCPResultMessage(ByteBuffer response)
-
Method Summary
Modifier and Type Method Description SCPResult
getResult()
int
getSequenceNumber()
boolean
isRetriable()
<T extends SCPResponse>
TparsePayload(SCPRequest<T> request)
Parse the payload data of the data into something higher level.<T> T
pickRequest(Map<Integer,T> requestStore)
Given a collection of requests, pick the one that correlates to this result.void
removeRequest(Map<Integer,?> requestStore)
Given a collection of requests, remove the one that correlates to this result.String
toString()
-
Constructor Details
-
SCPResultMessage
- 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
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
Given a collection of requests, remove the one that correlates to this result.- Parameters:
requestStore
- The store of requests.
-
parsePayload
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
- Returns:
- The result code from the header.
-
getSequenceNumber
public int getSequenceNumber()- Returns:
- The sequence number from the header.
-
toString
-