diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BackupTopologyListener.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BackupTopologyListener.java index 615279d7e8..f00bf4b602 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BackupTopologyListener.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BackupTopologyListener.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.server.impl; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener; import org.apache.activemq.artemis.api.core.client.TopologyMember; @@ -28,12 +29,22 @@ final class BackupTopologyListener implements ClusterTopologyListener { private final String ownId; private static final int WAIT_TIMEOUT = 60; - public BackupTopologyListener(String ownId) { + // Transport configuration of this node + private final TransportConfiguration myTc; + + public BackupTopologyListener(String ownId, TransportConfiguration nodeTransportConfig) { this.ownId = ownId; + this.myTc = nodeTransportConfig; } @Override public void nodeUP(TopologyMember topologyMember, boolean last) { + + // If the backup is this node then ignore. + if (myTc.equals(topologyMember.getBackup())) { + return; + } + final String nodeID = topologyMember.getNodeId(); if (ownId.equals(nodeID) && topologyMember.getBackup() != null) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java index 789e864a16..358d7ef189 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java @@ -168,7 +168,7 @@ public class SharedNothingLiveActivation extends LiveActivation { //backupUpToDate = false; if (isFailBackRequest && replicatedPolicy.isAllowAutoFailBack()) { - BackupTopologyListener listener1 = new BackupTopologyListener(activeMQServer.getNodeID().toString()); + BackupTopologyListener listener1 = new BackupTopologyListener(activeMQServer.getNodeID().toString(), clusterConnection.getConnector()); clusterConnection.addClusterTopologyListener(listener1); if (listener1.waitForBackup()) { //if we have to many backups kept or are not configured to restart just stop, otherwise restart as a backup diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java index 7f22ab14c9..2807affdca 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java @@ -20,6 +20,7 @@ import java.nio.channels.ClosedChannelException; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.persistence.StorageManager; @@ -196,7 +197,8 @@ public final class SharedStoreBackupActivation extends Activation { BackupTopologyListener backupListener; FailbackChecker() { - backupListener = new BackupTopologyListener(activeMQServer.getNodeID().toString()); + TransportConfiguration connector = activeMQServer.getClusterManager().getDefaultConnection(null).getConnector(); + backupListener = new BackupTopologyListener(activeMQServer.getNodeID().toString(), connector); activeMQServer.getClusterManager().getDefaultConnection(null).addClusterTopologyListener(backupListener); }