diff options
| author | Robert Gemmell <robbie@apache.org> | 2012-05-31 10:00:39 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2012-05-31 10:00:39 +0000 |
| commit | 4a51c5e1b7f11acbb744ebec4dbbb8df666c90dd (patch) | |
| tree | 6d59b20e23d85be0c80c3d56ed93a51e4916975f /java/client | |
| parent | 5195541513499f0682fdea616cdf505fa98417af (diff) | |
| download | qpid-python-4a51c5e1b7f11acbb744ebec4dbbb8df666c90dd.tar.gz | |
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/qpid@1344632 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client')
| -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(); |
