activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2527 Stop executors on print-data
Date Wed, 23 Oct 2019 20:03:14 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new d7dc8b8  ARTEMIS-2527 Stop executors on print-data
d7dc8b8 is described below

commit d7dc8b8de8c6dafbf802157363ab19dbb2987aa0
Author: Clebert Suconic <clebertsuconic@apache.org>
AuthorDate: Wed Oct 23 15:57:49 2019 -0400

    ARTEMIS-2527 Stop executors on print-data
---
 .../artemis/cli/commands/tools/PrintData.java        | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
index cc387b0..805f3c2 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
@@ -175,16 +175,17 @@ public class PrintData extends DBOption {
    }
 
    private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream
out, boolean safe) {
+      ActiveMQThreadFactory daemonFactory = new ActiveMQThreadFactory("cli", true, PrintData.class.getClassLoader());
+      final ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, daemonFactory);
+      final ExecutorService executor = Executors.newFixedThreadPool(10, daemonFactory);
+      ExecutorFactory execfactory = new ExecutorFactory() {
+         @Override
+         public ArtemisExecutor getExecutor() {
+            return ArtemisExecutor.delegate(executor);
+         }
+      };
       try {
 
-         ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory());
-         final ExecutorService executor = Executors.newFixedThreadPool(10, ActiveMQThreadFactory.defaultThreadFactory());
-         ExecutorFactory execfactory = new ExecutorFactory() {
-            @Override
-            public ArtemisExecutor getExecutor() {
-               return ArtemisExecutor.delegate(executor);
-            }
-         };
          final StorageManager sm = new NullStorageManager();
          PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory,
1000L, scheduled, execfactory, false, null);
          HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>();
@@ -194,6 +195,9 @@ public class PrintData extends DBOption {
          printPages(describeJournal, sm, manager, out, safe);
       } catch (Exception e) {
          e.printStackTrace();
+      } finally {
+         executor.shutdownNow();
+         scheduled.shutdownNow();
       }
    }
 


Mime
View raw message