mirror of https://github.com/apache/activemq.git
fix for AMQ-839 - lets not use == but compare the connectionIDs by value when removing a clientID
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@426764 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
73d14ce879
commit
cb77064b88
|
@ -28,6 +28,7 @@ import org.apache.activemq.broker.region.policy.PolicyMap;
|
|||
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,14 +210,20 @@ public class RegionBroker implements Broker {
|
|||
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 {
|
||||
ArrayList l = new ArrayList(connections);
|
||||
Connection rc[] = new Connection[l.size()];
|
||||
|
|
Loading…
Reference in New Issue