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.ComparableStores state about a particular set of responses expected by the CallHandler class.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) longfinish_(package private) ResultHandlerhandler_(package private) java.util.MaprecipientMap_(package private) java.util.MapresponseMap_
-
Constructor Summary
Constructors Constructor Description CallItem(ResultHandler handler, long finish)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResponse(java.lang.String responderId, Response response)Take delivery of a response object.intcompareTo(java.lang.Object o)Compares on timeout epochs.booleanisDone()Indicate whether this call item has received all the responses it's going to.private voidprocessResponse(java.lang.String responderId, Response response)Process a response when we have both the list of recipients and the response itself.voidsetRecipients(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:
compareToin interfacejava.lang.Comparable
-
-