activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r392003 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java
Date Thu, 06 Apr 2006 15:53:42 GMT
Author: jstrachan
Date: Thu Apr  6 08:53:32 2006
New Revision: 392003

URL: http://svn.apache.org/viewcvs?rev=392003&view=rev
Log:
insure unique JMX names across multiple connectors and connections

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java?rev=392003&r1=392002&r2=392003&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java
Thu Apr  6 08:53:32 2006
@@ -36,9 +36,10 @@
  */
 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 @@
     }
 
     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;
     }
 
 }



Mime
View raw message