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 2015/09/04 00:09:38 UTC

[2/4] activemq-artemis git commit: ARTEMIS-217 fixing dead lock

ARTEMIS-217 fixing dead lock

https://issues.apache.org/jira/browse/ARTEMIS-217 fixing dead lock

This is using a separate lock for notifications, this way we won't hold a lock while communicating on netty which was the issue here.


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

Branch: refs/heads/master
Commit: 220e39ef1fa0173f2da9772c5e4911681bbd056f
Parents: ab618d2
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Sep 3 09:29:15 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Sep 3 18:06:11 2015 -0400

----------------------------------------------------------------------
 .../artemis/core/client/impl/ServerLocatorImpl.java         | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/220e39ef/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
index deb17da..bed47b7 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
@@ -816,7 +816,9 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
                }
             }
          } while (retry);
+      }
 
+      synchronized (topologyArrayGuard) {
          // We always wait for the topology, as the server
          // will send a single element if not cluster
          // so clients can know the id of the server they are connected to
@@ -824,7 +826,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
          while (!isClosed() && !receivedTopology && timeout > System.currentTimeMillis()) {
             // Now wait for the topology
             try {
-               wait(1000);
+               topologyArrayGuard.wait(1000);
             }
             catch (InterruptedException e) {
                throw new ActiveMQInterruptedException(e);
@@ -847,7 +849,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
 
          return factory;
       }
-
    }
 
    public boolean isHA() {
@@ -1410,10 +1411,10 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
       updateArraysAndPairs();
 
       if (last) {
-         synchronized (this) {
+         synchronized (topologyArrayGuard) {
             receivedTopology = true;
             // Notify if waiting on getting topology
-            notifyAll();
+            topologyArrayGuard.notifyAll();
          }
       }
    }