Repository: activemq-artemis
Updated Branches:
  refs/heads/1.x be3702096 -> b0585329b


ARTEMIS-908: Replace lock by CAS to avoid deadlock

(cherry picked from commit 4622066323e9ba5af0777d0c7315389ee8f647f5)


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

Branch: refs/heads/1.x
Commit: b0585329b41fc074aea80fe952dde565dcef491d
Parents: be37020
Author: Ulf Lilleengen <[email protected]>
Authored: Wed Feb 15 15:49:11 2017 +0100
Committer: Clebert Suconic <[email protected]>
Committed: Wed Feb 15 10:46:46 2017 -0500

----------------------------------------------------------------------
 .../activemq/artemis/core/paging/impl/PagingStoreImpl.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b0585329/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
index 54992e4..4e57c85 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
@@ -637,7 +637,7 @@ public class PagingStoreImpl implements PagingStore {
    // To be used when the memory is oversized either by local settings or 
global settings on blocking addresses
    private static final class OverSizedRunnable implements Runnable {
 
-      private boolean ran;
+      private final AtomicBoolean ran = new AtomicBoolean(false);
 
       private final Runnable runnable;
 
@@ -646,11 +646,9 @@ public class PagingStoreImpl implements PagingStore {
       }
 
       @Override
-      public synchronized void run() {
-         if (!ran) {
+      public void run() {
+         if (ran.compareAndSet(false, true)) {
             runnable.run();
-
-            ran = true;
          }
       }
    }

Reply via email to