activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/3] activemq-artemis git commit: NO-JIRA Fixing a deadlock during #tearDown and TimedBuffer.stop
Date Wed, 21 Feb 2018 04:50:17 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 67d6bf484 -> 3823465e1


NO-JIRA Fixing a deadlock during #tearDown and TimedBuffer.stop


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

Branch: refs/heads/master
Commit: 0273e3e4ffc7c84d87a73628f3722726f74401ca
Parents: 67d6bf4
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Tue Feb 20 10:09:10 2018 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Feb 20 15:42:27 2018 -0500

----------------------------------------------------------------------
 .../artemis/core/io/buffer/TimedBuffer.java     | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0273e3e4/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
index 41137d9..9f809de 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
@@ -170,6 +170,7 @@ public final class TimedBuffer extends CriticalComponentImpl {
 
    public void stop() {
       enterCritical(CRITICAL_PATH_STOP);
+      Thread localTimer = null;
       try {
          // add critical analyzer here.... <<<<
          synchronized (this) {
@@ -190,17 +191,25 @@ public final class TimedBuffer extends CriticalComponentImpl {
                   logRatesTimerTask.cancel();
                }
 
-               while (timerThread.isAlive()) {
-                  try {
-                     timerThread.join();
-                  } catch (InterruptedException e) {
-                     throw new ActiveMQInterruptedException(e);
-                  }
-               }
+               localTimer = timerThread;
+               timerThread = null;
+
             } finally {
                started = false;
             }
          }
+         if (localTimer != null) {
+            while (localTimer.isAlive()) {
+               try {
+                  localTimer.join(1000);
+                  if (localTimer.isAlive()) {
+                     localTimer.interrupt();
+                  }
+               } catch (InterruptedException e) {
+                  throw new ActiveMQInterruptedException(e);
+               }
+            }
+         }
       } finally {
          leaveCritical(CRITICAL_PATH_STOP);
       }


Mime
View raw message