summaryrefslogtreecommitdiff
path: root/qpid/java/client/src
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-05-31 10:00:39 +0000
committerRobert Gemmell <robbie@apache.org>2012-05-31 10:00:39 +0000
commitd55d6f37c9475a638e721061aea2457f791c02a4 (patch)
tree125ab4886367e235ba5b9a7980cc960d92543f4d /qpid/java/client/src
parent55a0478936b93aab79c146c1923adeed4c870034 (diff)
downloadqpid-python-d55d6f37c9475a638e721061aea2457f791c02a4.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@1344632 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java20
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java5
2 files changed, 19 insertions, 6 deletions
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<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();