Package org.astrogrid.samp.gui
Class MessageTrackerHubConnector.CallAllHandler
- java.lang.Object
-
- org.astrogrid.samp.gui.MessageTrackerHubConnector.CallAllHandler
-
- Enclosing class:
- MessageTrackerHubConnector
private class MessageTrackerHubConnector.CallAllHandler extends java.lang.Object
Class used to keep track of outgoing callAll() messages. It needs to be able to match Responses with Transmissions, but the complication is that a Response may arrive either before or after its corresponding Transmission is known.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
msgTag_
private java.util.Map
responseMap_
private java.util.Collection
transSet_
-
Constructor Summary
Constructors Constructor Description CallAllHandler(java.lang.String msgTag)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResponse(java.lang.String responderId, Response response)
Supplies a response to the callAll invocation handled by this object.private void
processResponse(java.lang.String responderId, Response response)
Does the work of passing a received response to the relevant member of the transmission list.private void
retireIfDone()
Checks whether this object has any further work to do (any more responses are expected) and if not uninstalls itself, at which point it becomes unreachable and can be garbage collected.void
setTransmissions(Transmission[] transmissions)
Called once when the list of transmissions corresponding to the callAll invocation is known.
-
-
-
Method Detail
-
setTransmissions
public void setTransmissions(Transmission[] transmissions)
Called once when the list of transmissions corresponding to the callAll invocation is known.- Parameters:
transmissions
- list of transmission objects, one for each callAll recipient
-
addResponse
public void addResponse(java.lang.String responderId, Response response)
Supplies a response to the callAll invocation handled by this object.- Parameters:
responderId
- client ID of responderresponse
- response
-
processResponse
private void processResponse(java.lang.String responderId, Response response)
Does the work of passing a received response to the relevant member of the transmission list. May only be called followingsetTransmissions(org.astrogrid.samp.gui.Transmission[])
.- Parameters:
responderId
- client ID of responderresponse
- response
-
retireIfDone
private void retireIfDone()
Checks whether this object has any further work to do (any more responses are expected) and if not uninstalls itself, at which point it becomes unreachable and can be garbage collected. May only be called followingsetTransmissions(org.astrogrid.samp.gui.Transmission[])
.
-
-