diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java index b0cbbb38cd..ef1d7aa07c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java @@ -152,7 +152,7 @@ public class PagingStoreFactoryNIO implements PagingStoreFactory { @Override public synchronized PagingStore newStore(final SimpleString address, final AddressSettings settings) { - return new PagingStoreImpl(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, null, this, address, settings, executorFactory.getExecutor(), syncNonTransactional); + return new PagingStoreImpl(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, null, this, address, settings, executorFactory.getExecutor(), executorFactory.getExecutor(), syncNonTransactional); } @Override @@ -223,7 +223,7 @@ public class PagingStoreFactoryNIO implements PagingStoreFactory { AddressSettings settings = addressSettingsRepository.getMatch(address.toString()); - PagingStore store = new PagingStoreImpl(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, factory, this, address, settings, executorFactory.getExecutor(), syncNonTransactional); + PagingStore store = new PagingStoreImpl(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, factory, this, address, settings, executorFactory.getExecutor(), executorFactory.getExecutor(), syncNonTransactional); storesReturn.add(store); } 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 89cd5b6982..203303053c 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 @@ -140,6 +140,21 @@ public class PagingStoreImpl implements PagingStore { final AddressSettings addressSettings, final ArtemisExecutor executor, final boolean syncNonTransactional) { + this(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, fileFactory, storeFactory, storeName, addressSettings, executor, executor, syncNonTransactional); + } + + public PagingStoreImpl(final SimpleString address, + final ScheduledExecutorService scheduledExecutor, + final long syncTimeout, + final PagingManager pagingManager, + final StorageManager storageManager, + final SequentialFileFactory fileFactory, + final PagingStoreFactory storeFactory, + final SimpleString storeName, + final AddressSettings addressSettings, + final ArtemisExecutor executor, + final ArtemisExecutor ioExecutor, + final boolean syncNonTransactional) { if (pagingManager == null) { throw new IllegalStateException("Paging Manager can't be null"); } @@ -172,7 +187,7 @@ public class PagingStoreImpl implements PagingStore { this.syncNonTransactional = syncNonTransactional; if (scheduledExecutor != null && syncTimeout > 0) { - this.syncTimer = new PageSyncTimer(this, scheduledExecutor, executor, syncTimeout); + this.syncTimer = new PageSyncTimer(this, scheduledExecutor, ioExecutor, syncTimeout); } else { this.syncTimer = null; } @@ -275,22 +290,17 @@ public class PagingStoreImpl implements PagingStore { @Override public boolean isPaging() { - lock.readLock().lock(); - - try { - if (addressFullMessagePolicy == AddressFullMessagePolicy.BLOCK) { - return false; - } - if (addressFullMessagePolicy == AddressFullMessagePolicy.FAIL) { - return isFull(); - } - if (addressFullMessagePolicy == AddressFullMessagePolicy.DROP) { - return isFull(); - } - return paging; - } finally { - lock.readLock().unlock(); + AddressFullMessagePolicy policy = this.addressFullMessagePolicy; + if (policy == AddressFullMessagePolicy.BLOCK) { + return false; } + if (policy == AddressFullMessagePolicy.FAIL) { + return isFull(); + } + if (policy == AddressFullMessagePolicy.DROP) { + return isFull(); + } + return paging; } @Override