org.eclipse.paho.client.mqttv3.internal
Class Token

java.lang.Object
  extended by org.eclipse.paho.client.mqttv3.internal.Token

public class Token
extends Object


Field Summary
protected  MqttMessage message
           
 int messageID
           
 boolean notified
           
 
Constructor Summary
Token(String logContext)
           
 
Method Summary
 boolean checkResult()
           
 IMqttActionListener getActionCallback()
           
 IMqttAsyncClient getClient()
           
 MqttException getException()
           
 String getKey()
           
 MqttMessage getMessage()
           
 int getMessageID()
           
 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()
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

message

protected MqttMessage message

messageID

public int messageID

notified

public boolean notified
Constructor Detail

Token

public Token(String logContext)
Method Detail

getMessageID

public int getMessageID()

setMessageID

public void setMessageID(int messageID)

checkResult

public boolean checkResult()
                    throws MqttException
Throws:
MqttException

getException

public MqttException getException()

isComplete

public boolean isComplete()

isCompletePending

protected boolean isCompletePending()

isInUse

protected boolean isInUse()

setActionCallback

public void setActionCallback(IMqttActionListener listener)

getActionCallback

public IMqttActionListener getActionCallback()

waitForCompletion

public void waitForCompletion()
                       throws MqttException
Throws:
MqttException

waitForCompletion

public void waitForCompletion(long timeout)
                       throws MqttException
Throws:
MqttException

waitForResponse

protected MqttWireMessage waitForResponse()
                                   throws MqttException
Waits for the message delivery to complete, but doesn't throw an exception in the case of a NACK. It does still throw an exception if something else goes wrong (e.g. an IOException). This is used for packets like CONNECT, which have useful information in the ACK that needs to be accessed.

Throws:
MqttException

waitForResponse

protected MqttWireMessage waitForResponse(long timeout)
                                   throws MqttException
Throws:
MqttException

markComplete

protected void markComplete(MqttWireMessage msg,
                            MqttException ex)
Mark the token as complete and ready for users to be notified.

Parameters:
msg - response message. Optional - there are no response messages for some flows
ex - if there was a problem store the exception in the token.

notifyComplete

protected void notifyComplete()
Notifies this token that a response message (an ACK or NACK) has been received.


waitUntilSent

public void waitUntilSent()
                   throws MqttException
Throws:
MqttException

notifySent

protected void notifySent()
Notifies this token that the associated message has been sent (i.e. written to the TCP/IP socket).


getClient

public IMqttAsyncClient getClient()

setClient

protected void setClient(IMqttAsyncClient client)

reset

public void reset()
           throws MqttException
Throws:
MqttException

getMessage

public MqttMessage getMessage()

getWireMessage

public MqttWireMessage getWireMessage()

setMessage

public void setMessage(MqttMessage msg)

getTopics

public String[] getTopics()

setTopics

public void setTopics(String[] topics)

getUserContext

public Object getUserContext()

setUserContext

public void setUserContext(Object userContext)

setKey

public void setKey(String key)

getKey

public String getKey()

setException

public void setException(MqttException exception)

isNotified

public boolean isNotified()

setNotified

public void setNotified(boolean notified)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.