ARTEMIS-423 Do not set backup node as self
This commit is contained in:
parent
d2539e5161
commit
964b145733
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue