activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andytay...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-423 Do not set backup node as self
Date Tue, 01 Mar 2016 09:57:48 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master d2539e516 -> e40a5ead4


ARTEMIS-423 Do not set backup node as self


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/964b1457
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/964b1457
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/964b1457

Branch: refs/heads/master
Commit: 964b1457336d0edcff9b4fc132dc34b5f13f5228
Parents: d2539e5
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Mon Feb 29 12:55:02 2016 +0000
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Mon Feb 29 16:11:58 2016 +0000

----------------------------------------------------------------------
 .../core/server/impl/BackupTopologyListener.java       | 13 ++++++++++++-
 .../core/server/impl/SharedNothingLiveActivation.java  |  2 +-
 .../core/server/impl/SharedStoreBackupActivation.java  |  4 +++-
 3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/964b1457/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BackupTopologyListener.java
----------------------------------------------------------------------
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 615279d..f00bf4b 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)

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/964b1457/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
----------------------------------------------------------------------
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 789e864..358d7ef 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

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/964b1457/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java
----------------------------------------------------------------------
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 7f22ab1..2807aff 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);
       }
 


Mime
View raw message