You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/07/29 10:03:31 UTC
svn commit: r426764 -
/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
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 {