diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQConnection.java | 20 | ||||
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 5 |
2 files changed, 19 insertions, 6 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 23b47c8d67..d5b4352c02 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -78,11 +78,14 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; public class AMQConnection extends Closeable implements Connection, QueueConnection, TopicConnection, Referenceable { private static final Logger _logger = LoggerFactory.getLogger(AMQConnection.class); + private static final AtomicLong CONN_NUMBER_GENERATOR = new AtomicLong(); + private final long _connectionNumber; /** * This is the "root" mutex that must be held when doing anything that could be impacted by failover. This must be @@ -222,6 +225,13 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect throw new IllegalArgumentException("Connection must be specified"); } + _connectionNumber = CONN_NUMBER_GENERATOR.incrementAndGet(); + + if (_logger.isDebugEnabled()) + { + _logger.debug("Connection(" + _connectionNumber + "):" + connectionURL); + } + // set this connection maxPrefetch if (connectionURL.getOption(ConnectionURL.OPTIONS_MAXPREFETCH) != null) { @@ -308,11 +318,6 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect _delegate = new AMQConnectionDelegate_0_10(this); } - if (_logger.isDebugEnabled()) - { - _logger.debug("Connection:" + connectionURL); - } - _connectionURL = connectionURL; _clientName = connectionURL.getClientName(); @@ -1519,4 +1524,9 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect { return _delegate; } + + public Long getConnectionNumber() + { + return _connectionNumber; + } } diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index e500dac9e3..090b99d41a 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -2370,7 +2370,10 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic { throw new Error("Error creating Dispatcher thread",e); } - _dispatcherThread.setName("Dispatcher-Channel-" + _channelId); + + String dispatcherThreadName = "Dispatcher-Channel-" + _channelId + "-Conn-" + _connection.getConnectionNumber(); + + _dispatcherThread.setName(dispatcherThreadName); _dispatcherThread.setDaemon(DEAMON_DISPATCHER_THREAD); _dispatcher.setConnectionStopped(initiallyStopped); _dispatcherThread.start(); |
