diff --git a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index 0e885cca1..098a2009c 100644 --- a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -1105,4 +1105,15 @@ public abstract class XMPPConnection { public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) { return executorService.schedule(command, delay, unit); } + + /** + * Get the connection counter of this XMPPConnection instance. Those can be used as ID to + * identify the connection, but beware that the ID may not be unique if you create more then + * 2*Integer.MAX_VALUE instances as the counter could wrap. + * + * @return the connection counter of this XMPPConnection + */ + public int getConnectionCounter() { + return connectionCounterValue; + } }