From d55d6f37c9475a638e721061aea2457f791c02a4 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Thu, 31 May 2012 10:00:39 +0000 Subject: QPID-4033: update the Dispatcher thread name to include a connection id to ease identifying work for individual sessions on different connections during log analysis git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1344632 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/client/AMQConnection.java | 20 +++++++++++++++----- .../main/java/org/apache/qpid/client/AMQSession.java | 5 ++++- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'qpid/java/client/src') diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 23b47c8d67..d5b4352c02 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/qpid/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/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index e500dac9e3..090b99d41a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -2370,7 +2370,10 @@ public abstract class AMQSession