This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit e6fe9f9d923aedebb4cab00f07c49801b66c17e1
Author: Qihong Xu <[email protected]>
AuthorDate: Fri Jan 4 18:09:24 2019 +0800

    ARTEMIS-2216 Use a specific executor for pageSyncTimer
---
 .../core/paging/impl/PagingStoreFactoryNIO.java    |  4 +--
 .../artemis/core/paging/impl/PagingStoreImpl.java  | 42 +++++++++++++---------
 2 files changed, 28 insertions(+), 18 deletions(-)

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 b0cbbb3..ef1d7aa 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 89cd5b6..2033030 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

Reply via email to