You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/04/06 17:22:35 UTC

[1/2] activemq-artemis git commit: This closes #1175

Repository: activemq-artemis
Updated Branches:
  refs/heads/master f88311b04 -> 7d9ae1a83


This closes #1175


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

Branch: refs/heads/master
Commit: 7d9ae1a83ec657e3baffb4e8d8cf9038910809b6
Parents: f88311b 4a57aec
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Apr 6 13:22:30 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 6 13:22:30 2017 -0400

----------------------------------------------------------------------
 .../impl/NamedLiveNodeLocatorForReplication.java   | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-1094 replica + group-name fix

Posted by cl...@apache.org.
ARTEMIS-1094 replica + group-name fix

When a replica attempts to connect to a live server using a group-name
and there are > 1 servers on the network using that group there is a
chance it will fail because it doesn't keep track of all of the
topology data it receives. This fix ensures that all the topology data
from the cluster tracked until it is used and fails at which point it
is discarded.


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

Branch: refs/heads/master
Commit: 4a57aecbbfea6453e9d74ba398ea0f89ee28fdbb
Parents: f88311b
Author: Justin Bertram <jb...@apache.org>
Authored: Wed Apr 5 15:12:23 2017 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 6 13:22:30 2017 -0400

----------------------------------------------------------------------
 .../impl/NamedLiveNodeLocatorForReplication.java   | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4a57aecb/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java
index 101ae3b..a3c50fb 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.artemis.core.server.impl;
 
+import java.util.LinkedList;
+import java.util.Queue;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -38,7 +40,7 @@ public class NamedLiveNodeLocatorForReplication extends LiveNodeLocator {
    private final Lock lock = new ReentrantLock();
    private final Condition condition = lock.newCondition();
    private final String backupGroupName;
-   private Pair<TransportConfiguration, TransportConfiguration> liveConfiguration;
+   private Queue<Pair<TransportConfiguration, TransportConfiguration>> liveConfigurations = new LinkedList<>();
 
    private String nodeID;
 
@@ -56,12 +58,12 @@ public class NamedLiveNodeLocatorForReplication extends LiveNodeLocator {
    public void locateNode(long timeout) throws ActiveMQException {
       try {
          lock.lock();
-         if (liveConfiguration == null) {
+         if (liveConfigurations.size() == 0) {
             try {
                if (timeout != -1L) {
                   ConcurrentUtil.await(condition, timeout);
                } else {
-                  while (liveConfiguration == null) {
+                  while (liveConfigurations.size() == 0) {
                      condition.await();
                   }
                }
@@ -79,7 +81,10 @@ public class NamedLiveNodeLocatorForReplication extends LiveNodeLocator {
       try {
          lock.lock();
          if (backupGroupName.equals(topologyMember.getBackupGroupName()) && topologyMember.getLive() != null) {
-            liveConfiguration = new Pair<>(topologyMember.getLive(), topologyMember.getBackup());
+            Pair<TransportConfiguration, TransportConfiguration> liveConfiguration = new Pair<>(topologyMember.getLive(), topologyMember.getBackup());
+            if (!liveConfigurations.contains(liveConfiguration)) {
+               liveConfigurations.add(liveConfiguration);
+            }
             nodeID = topologyMember.getNodeId();
             condition.signal();
          }
@@ -100,14 +105,14 @@ public class NamedLiveNodeLocatorForReplication extends LiveNodeLocator {
 
    @Override
    public Pair<TransportConfiguration, TransportConfiguration> getLiveConfiguration() {
-      return liveConfiguration;
+      return liveConfigurations.peek();
    }
 
    @Override
    public void notifyRegistrationFailed(boolean alreadyReplicating) {
       try {
          lock.lock();
-         liveConfiguration = null;
+         liveConfigurations.poll();
          super.notifyRegistrationFailed(alreadyReplicating);
       } finally {
          lock.unlock();