Skip to content

Commit 767d91e

Browse files
committed
Issue #540 - Starting to fix MQTTv5 terminology - cleanSession -> cleanStart.
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
1 parent dedb7f9 commit 767d91e

20 files changed

Lines changed: 114 additions & 114 deletions

File tree

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/IMqttAsyncClient.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ IMqttToken connect(MqttConnectionOptions options, Object userContext, MqttAction
175175
* messages being accepted and does not send any messages that have been
176176
* accepted but not yet started delivery across the network to the server. When
177177
* work has completed or after the quiesce timeout, the client will disconnect
178-
* from the server. If the cleanSession flag was set to false and is set to
178+
* from the server. If the cleanStart flag was set to false and is set to
179179
* false the next time a connection is made QoS 1 and 2 messages that were not
180180
* previously delivered will be delivered.
181181
* </p>
@@ -429,7 +429,7 @@ IMqttToken subscribe(String topicFilter, int qos, Object userContext, MqttAction
429429
* method, otherwise any received messages will be discarded.
430430
* </p>
431431
* <p>
432-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to true when
432+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to true when
433433
* when connecting to the server then the subscription remains in place until
434434
* either:
435435
* </p>
@@ -440,15 +440,15 @@ IMqttToken subscribe(String topicFilter, int qos, Object userContext, MqttAction
440440
* </ul>
441441
*
442442
* <p>
443-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to false when
443+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to false when
444444
* connecting to the server then the subscription remains in place until either:
445445
* </p>
446446
* <ul>
447447
* <li>An unsubscribe method is called to unsubscribe the topic</li>
448-
* <li>The next time the client connects with cleanSession set to true</li>
448+
* <li>The next time the client connects with cleanStart set to true</li>
449449
* </ul>
450450
* <p>
451-
* With cleanSession set to false the MQTT server will store messages on behalf
451+
* With cleanStart set to false the MQTT server will store messages on behalf
452452
* of the client when the client is not connected. The next time the client
453453
* connects with the <b>same client ID</b> the server will deliver the stored
454454
* messages to the client.
@@ -834,9 +834,9 @@ IMqttToken unsubscribe(String[] topicFilters, Object userContext, MqttActionList
834834
* callback can be used to track the delivery of outstanding messages.
835835
* </p>
836836
* <p>
837-
* If a client connects with cleanSession true then there will be no delivery
838-
* tokens as the cleanSession option deletes all earlier state. For state to be
839-
* remembered the client must connect with cleanSession set to false
837+
* If a client connects with cleanStart true then there will be no delivery
838+
* tokens as the cleanStart option deletes all earlier state. For state to be
839+
* remembered the client must connect with cleanStart set to false
840840
* </P>
841841
*
842842
* @return zero or more delivery tokens
@@ -946,9 +946,9 @@ IMqttDeliveryToken publish(String topic, byte[] payload, int qos, boolean retain
946946
* <ul>
947947
* <li>The connection is re-established with the same clientID
948948
* <li>The original connection was made with (@link
949-
* MqttConnectOptions#setCleanSession(boolean)} set to false
949+
* MqttConnectOptions#setCleanStart(boolean)} set to false
950950
* <li>The connection is re-established with (@link
951-
* MqttConnectOptions#setCleanSession(boolean)} set to false
951+
* MqttConnectOptions#setCleanStart(boolean)} set to false
952952
* <li>Depending when the failure occurs QoS 0 messages may not be delivered.
953953
* </ul>
954954
*

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/IMqttClient.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public interface IMqttClient { //extends IMqttAsyncClient {
134134
* work which has already been initiated to complete - for example, it will
135135
* wait for the QoS 2 flows from earlier publications to complete. When work has
136136
* completed or after the quiesce timeout, the client will disconnect from
137-
* the server. If the cleanSession flag was set to false and is set to false the
137+
* the server. If the cleanStart flag was set to false and is set to false the
138138
* next time a connection is made QoS 1 and 2 messages that
139139
* were not previously delivered will be delivered.</p>
140140
*
@@ -227,7 +227,7 @@ public interface IMqttClient { //extends IMqttAsyncClient {
227227
* will be discarded.
228228
* </p>
229229
* <p>
230-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to true
230+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to true
231231
* when when connecting to the server then the subscription remains in place
232232
* until either:
233233
* </p>
@@ -236,15 +236,15 @@ public interface IMqttClient { //extends IMqttAsyncClient {
236236
* <li>An unsubscribe method is called to un-subscribe the topic</li>
237237
* </ul>
238238
* <p>
239-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to false
239+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to false
240240
* when when connecting to the server then the subscription remains in place
241241
* until either:</p>
242242
* <ul>
243243
* <li>An unsubscribe method is called to unsubscribe the topic</li>
244-
* <li>The client connects with cleanSession set to true</li>
244+
* <li>The client connects with cleanStart set to true</li>
245245
* </ul>
246246
* <p>
247-
* With cleanSession set to false the MQTT server will store messages on
247+
* With cleanStart set to false the MQTT server will store messages on
248248
* behalf of the client when the client is not connected. The next time the
249249
* client connects with the <b>same client ID</b> the server will
250250
* deliver the stored messages to the client.
@@ -363,23 +363,23 @@ public interface IMqttClient { //extends IMqttAsyncClient {
363363
* will be discarded.
364364
* </p>
365365
* <p>
366-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to true
366+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to true
367367
* when when connecting to the server then the subscription remains in place
368368
* until either:</p>
369369
* <ul>
370370
* <li>The client disconnects</li>
371371
* <li>An unsubscribe method is called to un-subscribe the topic</li>
372372
* </ul>
373373
* <p>
374-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to false
374+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to false
375375
* when when connecting to the server then the subscription remains in place
376376
* until either:</p>
377377
* <ul>
378378
* <li>An unsubscribe method is called to unsubscribe the topic</li>
379-
* <li>The client connects with cleanSession set to true</li>
379+
* <li>The client connects with cleanStart set to true</li>
380380
* </ul>
381381
* <p>
382-
* With cleanSession set to false the MQTT server will store messages on
382+
* With cleanStart set to false the MQTT server will store messages on
383383
* behalf of the client when the client is not connected. The next time the
384384
* client connects with the <b>same client ID</b> the server will
385385
* deliver the stored messages to the client.
@@ -471,23 +471,23 @@ public interface IMqttClient { //extends IMqttAsyncClient {
471471
* will be discarded.
472472
* </p>
473473
* <p>
474-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to true
474+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to true
475475
* when when connecting to the server then the subscription remains in place
476476
* until either:</p>
477477
* <ul>
478478
* <li>The client disconnects</li>
479479
* <li>An unsubscribe method is called to un-subscribe the topic</li>
480480
* </ul>
481481
* <p>
482-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to false
482+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to false
483483
* when when connecting to the server then the subscription remains in place
484484
* until either:</p>
485485
* <ul>
486486
* <li>An unsubscribe method is called to unsubscribe the topic</li>
487-
* <li>The client connects with cleanSession set to true</li>
487+
* <li>The client connects with cleanStart set to true</li>
488488
* </ul>
489489
* <p>
490-
* With cleanSession set to false the MQTT server will store messages on
490+
* With cleanStart set to false the MQTT server will store messages on
491491
* behalf of the client when the client is not connected. The next time the
492492
* client connects with the <b>same client ID</b> the server will
493493
* deliver the stored messages to the client.
@@ -564,7 +564,7 @@ public interface IMqttClient { //extends IMqttAsyncClient {
564564
* will be discarded.
565565
* </p>
566566
* <p>
567-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to true
567+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to true
568568
* when when connecting to the server then the subscription remains in place
569569
* until either:</p>
570570
* <ul>
@@ -573,15 +573,15 @@ public interface IMqttClient { //extends IMqttAsyncClient {
573573
* </ul>
574574
*
575575
* <p>
576-
* If (@link MqttConnectOptions#setCleanSession(boolean)} was set to false
576+
* If (@link MqttConnectOptions#setCleanStart(boolean)} was set to false
577577
* when when connecting to the server then the subscription remains in place
578578
* until either:</p>
579579
* <ul>
580580
* <li>An unsubscribe method is called to unsubscribe the topic</li>
581-
* <li>The client connects with cleanSession set to true</li>
581+
* <li>The client connects with cleanStart set to true</li>
582582
* </ul>
583583
* <p>
584-
* With cleanSession set to false the MQTT server will store messages on
584+
* With cleanStart set to false the MQTT server will store messages on
585585
* behalf of the client when the client is not connected. The next time the
586586
* client connects with the <b>same client ID</b> the server will
587587
* deliver the stored messages to the client.
@@ -715,9 +715,9 @@ public interface IMqttClient { //extends IMqttAsyncClient {
715715
* a connection is re-established to the server on condition that:</p>
716716
* <ul>
717717
* <li>The connection is re-established with the same clientID</li>
718-
* <li>The original connection was made with (@link MqttConnectOptions#setCleanSession(boolean)}
718+
* <li>The original connection was made with (@link MqttConnectOptions#setCleanStart(boolean)}
719719
* set to false</li>
720-
* <li>The connection is re-established with (@link MqttConnectOptions#setCleanSession(boolean)}
720+
* <li>The connection is re-established with (@link MqttConnectOptions#setCleanStart(boolean)}
721721
* set to false</li>
722722
* </ul>
723723
* <p>In the event that the connection breaks or the client stops it is still possible to determine
@@ -860,9 +860,9 @@ public interface IMqttClient { //extends IMqttAsyncClient {
860860
* Alternately the {@link MqttCallback#deliveryComplete(IMqttDeliveryToken)}
861861
* callback can be used to track the delivery of outstanding messages.
862862
* </p>
863-
* <p>If a client connects with cleanSession true then there will be no
864-
* delivery tokens as the cleanSession option deletes all earlier state.
865-
* For state to be remembered the client must connect with cleanSession
863+
* <p>If a client connects with cleanStart true then there will be no
864+
* delivery tokens as the cleanStart option deletes all earlier state.
865+
* For state to be remembered the client must connect with cleanStart
866866
* set to false</P>
867867
* @return zero or more delivery tokens
868868
*/

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/MqttActionListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface MqttActionListener {
2020
* This method is invoked when an action fails.
2121
* If a client is disconnected while an action is in progress
2222
* onFailure will be called. For connections
23-
* that use cleanSession set to false, any QoS 1 and 2 messages that
23+
* that use cleanStart set to false, any QoS 1 and 2 messages that
2424
* are in the process of being delivered will be delivered to the requested
2525
* quality of service next time the client connects.
2626
* @param asyncActionToken associated with the action that has failed

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/MqttAsyncClient.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@
9797
* hence can be lost if the client, Java runtime or device shuts down.
9898
* </p>
9999
* <p>
100-
* If connecting with {@link MqttConnectionOptions#setCleanSession(boolean)} set
100+
* If connecting with {@link MqttConnectionOptions#setCleanStart(boolean)} set
101101
* to true it is safe to use memory persistence as all state is cleared when a
102-
* client disconnects. If connecting with cleanSession set to false in order to
102+
* client disconnects. If connecting with cleanStart set to false in order to
103103
* provide reliable message delivery then a persistent message store such as the
104104
* default one should be used.
105105
* </p>
@@ -422,8 +422,8 @@ public MqttAsyncClient(String serverURI, String clientId) throws MqttException {
422422
* {@link MqttClientPersistence} interface. An implementer of this interface
423423
* that safely stores messages must be specified in order for delivery of
424424
* messages to be reliable. In addition
425-
* {@link MqttConnectionOptions#setCleanSession(boolean)} must be set to false.
426-
* In the event that only QoS 0 messages are sent or received or cleanSession is
425+
* {@link MqttConnectionOptions#setCleanStart(boolean)} must be set to false.
426+
* In the event that only QoS 0 messages are sent or received or cleanStart is
427427
* set to true then a safe store is not needed.
428428
* </p>
429429
* <p>
@@ -525,8 +525,8 @@ public MqttAsyncClient(String serverURI, String clientId, MqttClientPersistence
525525
* {@link MqttClientPersistence} interface. An implementer of this interface
526526
* that safely stores messages must be specified in order for delivery of
527527
* messages to be reliable. In addition
528-
* {@link MqttConnectionOptions#setCleanSession(boolean)} must be set to false.
529-
* In the event that only QoS 0 messages are sent or received or cleanSession is
528+
* {@link MqttConnectionOptions#setCleanStart(boolean)} must be set to false.
529+
* In the event that only QoS 0 messages are sent or received or cleanStart is
530530
* set to true then a safe store is not needed.
531531
* </p>
532532
* <p>
@@ -880,10 +880,10 @@ public IMqttToken connect(MqttConnectionOptions options, Object userContext, Mqt
880880
this.userContext = userContext;
881881
final boolean automaticReconnect = options.isAutomaticReconnect();
882882

883-
// @TRACE 103=cleanSession={0} connectionTimeout={1} TimekeepAlive={2}
883+
// @TRACE 103=cleanStart={0} connectionTimeout={1} TimekeepAlive={2}
884884
// userName={3} password={4} will={5} userContext={6} callback={7}
885885
log.fine(CLASS_NAME, methodName, "103",
886-
new Object[] { Boolean.valueOf(options.isCleanSession()), new Integer(options.getConnectionTimeout()),
886+
new Object[] { Boolean.valueOf(options.isCleanStart()), new Integer(options.getConnectionTimeout()),
887887
new Integer(options.getKeepAliveInterval()), options.getUserName(),
888888
((null == options.getPassword()) ? "[null]" : "[notnull]"),
889889
((null == options.getWillMessage()) ? "[null]" : "[notnull]"), userContext, callback });
@@ -906,11 +906,11 @@ public IMqttToken connect(MqttConnectionOptions options, Object userContext, Mqt
906906
connectActionListener.setMqttCallbackExtended((MqttCallback) this.mqttCallback);
907907
}
908908

909-
if (this.connOpts.isCleanSession()) {
909+
if (this.connOpts.isCleanStart()) {
910910
this.mqttSession.clearSession();
911911
}
912912

913-
if (this.connOpts.isCleanSession()) {
913+
if (this.connOpts.isCleanStart()) {
914914
this.mqttSession.clearSession();
915915
}
916916

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/MqttConnectionOptions.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void setWillMessageProperties(MqttProperties willMessageProperties) {
9999

100100
// Connection packet properties
101101
private int mqttVersion = 5; // MQTT Version 5
102-
private boolean cleanSession = true; // Clean Session
102+
private boolean cleanStart = true; // Clean Session
103103
private String willDestination = null; // Will Topic
104104
private MqttMessage willMessage = null; // Will Message
105105
private String userName; // Username
@@ -215,8 +215,8 @@ public void setWill(String topic, MqttMessage message) {
215215
*
216216
* @return the clean session flag
217217
*/
218-
public boolean isCleanSession() {
219-
return this.cleanSession;
218+
public boolean isCleanStart() {
219+
return this.cleanStart;
220220
}
221221

222222
/**
@@ -240,11 +240,11 @@ public boolean isCleanSession() {
240240
* </ul>
241241
* </ul>
242242
*
243-
* @param cleanSession
243+
* @param cleanStart
244244
* Set to True to enable cleanSession
245245
*/
246-
public void setCleanSession(boolean cleanSession) {
247-
this.cleanSession = cleanSession;
246+
public void setCleanStart(boolean cleanStart) {
247+
this.cleanStart = cleanStart;
248248
}
249249

250250
/**
@@ -368,15 +368,15 @@ public String[] getServerURIs() {
368368
* connects to.
369369
* </p>
370370
* <p>
371-
* The cleansession flag must be set to false if durable subscriptions and/or
371+
* The cleanStart flag must be set to false if durable subscriptions and/or
372372
* reliable message delivery is required.
373373
* </p>
374374
* </li>
375375
* <li>Hunt List
376376
* <p>
377377
* A set of servers may be specified that are not "equal" (as in the high
378378
* availability option). As no state is shared across the servers reliable
379-
* message delivery and durable subscriptions are not valid. The cleansession
379+
* message delivery and durable subscriptions are not valid. The cleanStart
380380
* flag must be set to true if the hunt list mode is used
381381
* </p>
382382
* </li>
@@ -914,7 +914,7 @@ public Properties getDebug() {
914914
final String strNull = "null";
915915
Properties p = new Properties();
916916
p.put("MqttVersion", getMqttVersion());
917-
p.put("CleanSession", Boolean.valueOf(isCleanSession()));
917+
p.put("CleanStart", Boolean.valueOf(isCleanStart()));
918918
p.put("ConTimeout", getConnectionTimeout());
919919
p.put("KeepAliveInterval", getKeepAliveInterval());
920920
p.put("UserName", (getUserName() == null) ? strNull : getUserName());

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/MqttConnectionOptionsBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public MqttConnectionOptionsBuilder connectionTimeout(int connectionTimeout) {
4242
return this;
4343
}
4444

45-
public MqttConnectionOptionsBuilder cleanSession(boolean cleanSession) {
46-
mqttConnectionOptions.setCleanSession(cleanSession);
45+
public MqttConnectionOptionsBuilder cleanStart(boolean cleanStart) {
46+
mqttConnectionOptions.setCleanStart(cleanStart);
4747
return this;
4848
}
4949

0 commit comments

Comments
 (0)