Skip to content

Commit 0ec53db

Browse files
committed
[MQTTv5] Enable use of Java's try-with-resources statement
For MQTTv3 this has already been done with #446 Signed-off-by: Alexander Straube <[email protected]>
1 parent bd291f1 commit 0ec53db

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.eclipse.paho.mqttv5.common.MqttSubscription;
2525
import org.eclipse.paho.mqttv5.common.packet.MqttProperties;
2626

27-
public interface IMqttAsyncClient {
27+
public interface IMqttAsyncClient extends AutoCloseable {
2828

2929
/**
3030
* Connects to an MQTT server using the default options.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
* style. The blocking client provides compatibility with earlier versions
6363
* of the MQTT client.</p>
6464
*/
65-
public interface IMqttClient { //extends IMqttAsyncClient {
65+
public interface IMqttClient extends AutoCloseable { //extends IMqttAsyncClient {
6666
/**
6767
* Connects to an MQTT server using the default options.
6868
* <p>The default options are specified in {@link MqttConnectionOptions} class.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* It is up to the persistence interface to log any exceptions or error information
3636
* which may be required when diagnosing a persistence failure.</p>
3737
*/
38-
public interface MqttClientPersistence {
38+
public interface MqttClientPersistence extends AutoCloseable {
3939
/**
4040
* Initialise the persistent store.
4141
* If a persistent store exists for this client ID then open it, otherwise

0 commit comments

Comments
 (0)