From 364cbd81da2ffbe37865cbf607a681749d6785e1 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 15 Mar 2014 11:39:38 +0100 Subject: [PATCH] Add getter for connectionCounter to XMPPConnection --- .../java/org/jivesoftware/smack/XMPPConnection.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; + } }