public class CommsTokenStore extends Object
saveToken(MqttToken, MqttWireMessage)
method.
Anyone interested in tacking the state can call one of the wait methods on the token or using the asynchronous
listener callback method on the operation. The CommsReceiver
class, on another thread, reads responses back
from the network. It uses the response to find the relevant token, which it can then notify.
Note: Ping, connect and disconnect do not have a unique message id as only one outstanding request of each type is
allowed to be outstandingConstructor and Description |
---|
CommsTokenStore(String logContext) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Empties the token store without notifying any of the tokens.
|
int |
count() |
MqttDeliveryToken[] |
getOutstandingDelTokens() |
Vector<MqttToken> |
getOutstandingTokens() |
MqttToken |
getToken(MqttWireMessage message)
Based on the message type that has just been received return the associated token from the token store or null if
one does not exist.
|
MqttToken |
getToken(String key) |
void |
open() |
protected void |
quiesce(MqttException quiesceResponse) |
MqttToken |
removeToken(MqttWireMessage message) |
MqttToken |
removeToken(String key) |
protected MqttDeliveryToken |
restoreToken(MqttPublish message)
Restores a token after a client restart.
|
protected void |
saveToken(MqttToken token,
MqttWireMessage message) |
protected void |
saveToken(MqttToken token,
String key) |
String |
toString()
Returns a string representation of the object.
|
public CommsTokenStore(String logContext)
public void clear()
public int count()
public MqttDeliveryToken[] getOutstandingDelTokens()
@Nullable public MqttToken getToken(MqttWireMessage message)
message
- whose token is to be returnedpublic void open()
protected void quiesce(MqttException quiesceResponse)
@Nullable public MqttToken removeToken(@Nullable MqttWireMessage message)
protected MqttDeliveryToken restoreToken(MqttPublish message)
protected void saveToken(MqttToken token, MqttWireMessage message) throws MqttException
MqttException
public String toString()
Object
toString
method returns a
string that "textually represents" this object. The result should be a concise but informative
representation that is easy for a person to read. It is recommended that all subclasses override
this method.
The toString
method for class Object
returns a string consisting of the name of
the class of which the object is an instance, the at-sign character `@
', and the unsigned
hexadecimal representation of the hash code of the object. In other words, this method returns a
string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())