ARTEMIS-908: Replace lock by CAS to avoid deadlock

This commit is contained in:
Ulf Lilleengen 2017-02-15 15:49:11 +01:00 committed by Clebert Suconic
parent 6474c41ce6
commit 4622066323
1 changed files with 3 additions and 5 deletions

View File

@ -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;
}
}
}