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.ObjectClass 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.StringmsgTag_private java.util.MapresponseMap_private java.util.CollectiontransSet_
-
Constructor Summary
Constructors Constructor Description CallAllHandler(java.lang.String msgTag)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResponse(java.lang.String responderId, Response response)Supplies a response to the callAll invocation handled by this object.private voidprocessResponse(java.lang.String responderId, Response response)Does the work of passing a received response to the relevant member of the transmission list.private voidretireIfDone()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.voidsetTransmissions(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[]).
-
-