From 2f7ab768175aca585fc3ec69ff581ca02c2e6925 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 6 Apr 2006 15:53:32 +0000 Subject: [PATCH] insure unique JMX names across multiple connectors and connections git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@392003 13f79535-47bb-0310-9956-ffa450edef68 --- .../broker/jmx/ManagedTransportConnector.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java index 066215e008..72d90fcd34 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java @@ -36,9 +36,10 @@ import java.net.URISyntaxException; */ public class ManagedTransportConnector extends TransportConnector { + static long nextConnectionId = 1; + private final MBeanServer mbeanServer; private final ObjectName connectorName; - long nextConnectionId = 1; public ManagedTransportConnector(MBeanServer mbeanServer, ObjectName connectorName, Broker next, TransportServer server) { super(next, server); @@ -51,13 +52,12 @@ public class ManagedTransportConnector extends TransportConnector { } protected Connection createConnection(Transport transport) throws IOException { - - final String connectionId; - synchronized (this) { - connectionId = "" + (nextConnectionId++); - } - + String connectionId = "" + getNextConnectionId(); return new ManagedTransportConnection(this, transport, getBroker(), getTaskRunnerFactory(), mbeanServer, connectorName, connectionId); } + protected static synchronized long getNextConnectionId() { + return nextConnectionId; + } + }