public class ClientState extends Object
Modifier | Constructor and Description |
---|---|
protected |
ClientState(MqttClientPersistence persistence,
CommsTokenStore tokenStore,
CommsCallback callback,
ClientComms clientComms,
MqttPingSender pingSender) |
Modifier and Type | Method and Description |
---|---|
MqttToken |
checkForActivity()
Check and send a ping if needed and check for ping timeout.
|
protected boolean |
checkQuiesceLock() |
protected void |
clearState() |
protected void |
close()
Tidy up
- ensure that tokens are released as they are maintained over a
disconnect / connect cycle.
|
void |
connected()
Called when the client has successfully connected to the broker
|
protected void |
deliveryComplete(MqttPublish message) |
void |
disconnected(MqttException reason)
Called when the client has been disconnected from the broker.
|
protected MqttWireMessage |
get()
This returns the next piece of work, ie message, for the CommsSender
to send over the network.
|
Properties |
getDebug() |
protected long |
getKeepAlive() |
protected void |
notifyComplete(MqttToken token)
Called when waiters and callbacks have processed the message.
|
void |
notifyQueueLock() |
protected void |
notifyReceivedAck(MqttAck ack)
Called by the CommsReceiver when an ack has arrived.
|
void |
notifyReceivedBytes(int receivedBytesCount) |
protected void |
notifyReceivedMsg(MqttWireMessage message)
Called by the CommsReceiver when a message has been received.
|
protected void |
notifyResult(MqttWireMessage ack,
MqttToken token,
MqttException ex) |
protected void |
notifySent(MqttWireMessage message)
Called by the CommsSender when a message has been sent
|
void |
notifySentBytes(int sentBytesCount)
COMMENTED OUT AS NO LONGER USED.
|
void |
quiesce(long timeout)
Quiesce the client state, preventing any new messages getting sent,
and preventing the callback on any newly received messages.
|
Vector |
resolveOldTokens(MqttException reason)
Called during shutdown to work out if there are any tokens still
to be notified and waiters to be unblocked.
|
protected void |
restoreState()
Restores the state information from persistence.
|
void |
send(MqttWireMessage message,
MqttToken token)
Submits a message for delivery.
|
protected void |
setCleanSession(boolean cleanSession) |
void |
setKeepAliveInterval(long interval) |
protected void |
setKeepAliveSecs(long keepAliveSecs) |
protected void |
undo(MqttPublish message)
This removes the MqttSend message from the outbound queue and persistence.
|
protected ClientState(MqttClientPersistence persistence, CommsTokenStore tokenStore, CommsCallback callback, ClientComms clientComms, MqttPingSender pingSender) throws MqttException
MqttException
protected void setKeepAliveSecs(long keepAliveSecs)
protected long getKeepAlive()
protected void setCleanSession(boolean cleanSession)
protected void clearState() throws MqttException
MqttException
protected void restoreState() throws MqttException
MqttException
public void send(MqttWireMessage message, MqttToken token) throws MqttException
message
- the message to sendtoken
- the token that can be used to track delivery of the messageMqttException
protected void undo(MqttPublish message) throws MqttPersistenceException
message
- MqttPersistenceException
public MqttToken checkForActivity() throws MqttException
MqttException
protected MqttWireMessage get() throws MqttException
#disconnected(MqttException, boolean)
is calledMqttException
public void setKeepAliveInterval(long interval)
public void notifySentBytes(int sentBytesCount)
protected void notifySent(MqttWireMessage message)
message
- protected boolean checkQuiesceLock()
public void notifyReceivedBytes(int receivedBytesCount)
protected void notifyReceivedAck(MqttAck ack) throws MqttException
message
- MqttException
protected void notifyReceivedMsg(MqttWireMessage message) throws MqttException
message
- MqttException
protected void notifyComplete(MqttToken token) throws MqttException
message
- MqttException
protected void notifyResult(MqttWireMessage ack, MqttToken token, MqttException ex)
public void connected()
public Vector resolveOldTokens(MqttException reason)
reason
- The root cause of the disconnection, or null if it is a clean disconnectpublic void disconnected(MqttException reason)
reason
- The root cause of the disconnection, or null if it is a clean disconnectpublic void quiesce(long timeout)
public void notifyQueueLock()
protected void deliveryComplete(MqttPublish message) throws MqttPersistenceException
MqttPersistenceException
protected void close()
public Properties getDebug()
Copyright © 2017 Eclipse Paho. All rights reserved.