public class Token extends Object
Modifier and Type | Field and Description |
---|---|
protected MqttMessage |
message |
Modifier and Type | Method and Description |
---|---|
boolean |
checkResult() |
IMqttActionListener |
getActionCallback() |
IMqttAsyncClient |
getClient() |
MqttException |
getException() |
int[] |
getGrantedQos() |
String |
getKey() |
MqttMessage |
getMessage() |
int |
getMessageID() |
MqttWireMessage |
getResponse() |
boolean |
getSessionPresent() |
String[] |
getTopics() |
Object |
getUserContext() |
MqttWireMessage |
getWireMessage() |
boolean |
isComplete() |
protected boolean |
isCompletePending() |
protected boolean |
isInUse() |
boolean |
isNotified() |
protected void |
markComplete(MqttWireMessage msg,
MqttException ex)
Mark the token as complete and ready for users to be notified.
|
protected void |
notifyComplete()
Notifies this token that a response message (an ACK or NACK) has been received.
|
protected void |
notifySent()
Notifies this token that the associated message has been sent (i.e.
|
void |
reset() |
void |
setActionCallback(IMqttActionListener listener) |
protected void |
setClient(IMqttAsyncClient client) |
void |
setException(MqttException exception) |
void |
setKey(String key) |
void |
setMessage(MqttMessage msg) |
void |
setMessageID(int messageID) |
void |
setNotified(boolean notified) |
void |
setTopics(String[] topics) |
void |
setUserContext(Object userContext) |
String |
toString()
Returns a string representation of the object.
|
void |
waitForCompletion() |
void |
waitForCompletion(long timeout) |
protected MqttWireMessage |
waitForResponse()
Waits for the message delivery to complete, but doesn't throw an exception in the case of a NACK.
|
protected MqttWireMessage |
waitForResponse(long timeout) |
void |
waitUntilSent() |
@Nullable protected MqttMessage message
public Token(String logContext)
public boolean checkResult() throws MqttException
MqttException
@Nullable public IMqttActionListener getActionCallback()
@Nullable public IMqttAsyncClient getClient()
@Nullable public MqttException getException()
public int[] getGrantedQos()
@Nullable public MqttMessage getMessage()
public int getMessageID()
@Nullable public MqttWireMessage getResponse()
public boolean getSessionPresent()
@Nullable public MqttWireMessage getWireMessage()
public boolean isComplete()
protected boolean isCompletePending()
protected boolean isInUse()
public boolean isNotified()
protected void markComplete(@Nullable MqttWireMessage msg, @Nullable MqttException ex)
msg
- response message. Optional - there are no response messages for some flowsex
- if there was a problem store the exception in the token.protected void notifyComplete()
protected void notifySent()
public void reset() throws MqttException
MqttException
public void setActionCallback(IMqttActionListener listener)
protected void setClient(IMqttAsyncClient client)
public void setException(@Nullable MqttException exception)
public void setKey(String key)
public void setMessage(MqttMessage msg)
public void setMessageID(int messageID)
public void setNotified(boolean notified)
public void setTopics(String[] topics)
public void setUserContext(Object userContext)
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())
public void waitForCompletion() throws MqttException
MqttException
public void waitForCompletion(long timeout) throws MqttException
MqttException
@Nullable protected MqttWireMessage waitForResponse() throws MqttException
MqttException
@Nullable protected MqttWireMessage waitForResponse(long timeout) throws MqttException
MqttException
public void waitUntilSent() throws MqttException
MqttException