From a48046be5fbb163bc12e626353fdf11781e2abbf Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Thu, 8 Oct 2015 18:14:27 -0400 Subject: [PATCH] ARTEMIS-151 more fixes because of the TransportConfiguration changes --- .../artemis/api/core/TransportConfiguration.java | 11 ++++++++++- .../core/client/impl/ClientSessionFactoryImpl.java | 2 +- .../artemis/core/client/impl/TopologyMemberImpl.java | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java index bdb49bb30e..666c5c8369 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java @@ -174,10 +174,19 @@ public class TransportConfiguration implements Serializable { TransportConfiguration that = (TransportConfiguration) o; - if (!factoryClassName.equals(that.factoryClassName)) + if (!isSameHost(that)) { return false; + } + if (name != null ? !name.equals(that.name) : that.name != null) return false; + + return true; + } + + public boolean isSameHost(TransportConfiguration that) { + if (!factoryClassName.equals(that.factoryClassName)) + return false; if (params != null ? !params.equals(that.params) : that.params != null) return false; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java index acdf1e8e35..ed588ef364 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java @@ -1269,7 +1269,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C Pair connectorPair, boolean isLast) { // if it is our connector then set the live id used for failover - if (connectorPair.getA() != null && connectorPair.getA().equals(connectorConfig)) { + if (connectorPair.getA() != null && connectorPair.getA().isSameHost(connectorConfig)) { liveNodeID = nodeID; } serverLocator.notifyNodeUp(uniqueEventID, nodeID, backupGroupName, scaleDownGroupName, connectorPair, isLast); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java index f220457bff..7c11cd0a52 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java @@ -107,7 +107,7 @@ public final class TopologyMemberImpl implements TopologyMember { } public boolean isMember(TransportConfiguration configuration) { - if (getConnector().getA() != null && getConnector().getA().equals(configuration) || getConnector().getB() != null && getConnector().getB().equals(configuration)) { + if (getConnector().getA() != null && getConnector().getA().isSameHost(configuration) || getConnector().getB() != null && getConnector().getB().isSameHost(configuration)) { return true; } else {