Package org.astrogrid.samp.client
Class HubConnector.CallItem
- java.lang.Object
-
- org.astrogrid.samp.client.HubConnector.CallItem
-
- All Implemented Interfaces:
java.lang.Comparable
- Enclosing class:
- HubConnector
private class HubConnector.CallItem extends java.lang.Object implements java.lang.Comparable
Stores state about a particular set of responses expected by the CallHandler class.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) long
finish_
(package private) ResultHandler
handler_
(package private) java.util.Map
recipientMap_
(package private) java.util.Map
responseMap_
-
Constructor Summary
Constructors Constructor Description CallItem(ResultHandler handler, long finish)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResponse(java.lang.String responderId, Response response)
Take delivery of a response object.int
compareTo(java.lang.Object o)
Compares on timeout epochs.boolean
isDone()
Indicate whether this call item has received all the responses it's going to.private void
processResponse(java.lang.String responderId, Response response)
Process a response when we have both the list of recipients and the response itself.void
setRecipients(java.lang.String[] recipientIds)
Sets the recipient Ids for which responses are expected.
-
-
-
Field Detail
-
handler_
final ResultHandler handler_
-
finish_
final long finish_
-
responseMap_
volatile java.util.Map responseMap_
-
recipientMap_
volatile java.util.Map recipientMap_
-
-
Constructor Detail
-
CallItem
CallItem(ResultHandler handler, long finish)
Constructor.- Parameters:
handler
- callback objectfinish
- epoch at which timeout should be called
-
-
Method Detail
-
setRecipients
public void setRecipients(java.lang.String[] recipientIds)
Sets the recipient Ids for which responses are expected.- Parameters:
recipientIds
- recipient client ids
-
addResponse
public void addResponse(java.lang.String responderId, Response response)
Take delivery of a response object.- Parameters:
responderId
- client ID of responderresponse
- response object
-
processResponse
private void processResponse(java.lang.String responderId, Response response)
Process a response when we have both the list of recipients and the response itself.- Parameters:
responderId
- client ID of responderresponse
- response object
-
isDone
public boolean isDone()
Indicate whether this call item has received all the responses it's going to.- Returns:
- iff no further activity is expected
-
compareTo
public int compareTo(java.lang.Object o)
Compares on timeout epochs. Implementation is consistent with equals, which means it's OK to use them in a SortedMap.- Specified by:
compareTo
in interfacejava.lang.Comparable
-
-