ARTEMIS-2527 Stop executors on print-data
This commit is contained in:
parent
4f3df1f1e4
commit
d7dc8b8de8
|
@ -175,16 +175,17 @@ public class PrintData extends DBOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe) {
|
private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe) {
|
||||||
try {
|
ActiveMQThreadFactory daemonFactory = new ActiveMQThreadFactory("cli", true, PrintData.class.getClassLoader());
|
||||||
|
final ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, daemonFactory);
|
||||||
ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory());
|
final ExecutorService executor = Executors.newFixedThreadPool(10, daemonFactory);
|
||||||
final ExecutorService executor = Executors.newFixedThreadPool(10, ActiveMQThreadFactory.defaultThreadFactory());
|
|
||||||
ExecutorFactory execfactory = new ExecutorFactory() {
|
ExecutorFactory execfactory = new ExecutorFactory() {
|
||||||
@Override
|
@Override
|
||||||
public ArtemisExecutor getExecutor() {
|
public ArtemisExecutor getExecutor() {
|
||||||
return ArtemisExecutor.delegate(executor);
|
return ArtemisExecutor.delegate(executor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
|
|
||||||
final StorageManager sm = new NullStorageManager();
|
final StorageManager sm = new NullStorageManager();
|
||||||
PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory, 1000L, scheduled, execfactory, false, null);
|
PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory, 1000L, scheduled, execfactory, false, null);
|
||||||
HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>();
|
HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>();
|
||||||
|
@ -194,6 +195,9 @@ public class PrintData extends DBOption {
|
||||||
printPages(describeJournal, sm, manager, out, safe);
|
printPages(describeJournal, sm, manager, out, safe);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
executor.shutdownNow();
|
||||||
|
scheduled.shutdownNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue