activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r426764 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
Date Sat, 29 Jul 2006 08:03:31 GMT
Author: jstrachan
Date: Sat Jul 29 01:03:31 2006
New Revision: 426764

URL: http://svn.apache.org/viewvc?rev=426764&view=rev
Log:
fix for AMQ-839 - lets not use == but compare the connectionIDs by value when removing a clientID

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java?rev=426764&r1=426763&r2=426764&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
Sat Jul 29 01:03:31 2006
@@ -28,6 +28,7 @@
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.BrokerId;
 import org.apache.activemq.command.BrokerInfo;
+import org.apache.activemq.command.ConnectionId;
 import org.apache.activemq.command.ConnectionInfo;
 import org.apache.activemq.command.ConsumerInfo;
 import org.apache.activemq.command.DestinationInfo;
@@ -209,12 +210,18 @@
         synchronized (clientIdSet) {
             ConnectionInfo oldValue = (ConnectionInfo) clientIdSet.get(clientId);
             // we may be removing the duplicate connection, not the first connection to be
created
-            if (oldValue == info) {
-                clientIdSet.remove(clientId);
+            // so lets check that their connection IDs are the same
+            if (oldValue != null) {
+                if (isEqual(oldValue.getConnectionId(), info.getConnectionId())) {
+                    clientIdSet.remove(clientId);
+                }
             }
         }
-
         connections.remove(context.getConnection());
+    }
+
+    protected boolean isEqual(ConnectionId connectionId, ConnectionId connectionId2) {
+        return connectionId == connectionId2 || (connectionId != null && connectionId.equals(connectionId2));
     }
 
     public Connection[] getClients() throws Exception {



Mime
View raw message