From 2546cf52c0fde9b7d5f6a1be3e13ea8a4a64aeac Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 19 Apr 2016 18:50:56 -0400 Subject: [PATCH] ARTEMIS-482 testsuite fixes: The new Executor operationr needs to be synchronized as a few tests are failing because of this another fix on the test base class --- .../artemis/core/remoting/impl/invm/InVMConnector.java | 4 ++-- .../apache/activemq/artemis/tests/util/ActiveMQTestBase.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java index c222d0d8c24..9f965ea18cd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java @@ -94,14 +94,14 @@ private static synchronized void incFailures() { private static ExecutorService threadPoolExecutor; - public static void resetThreadPool() { + public static synchronized void resetThreadPool() { if (threadPoolExecutor != null) { threadPoolExecutor.shutdown(); threadPoolExecutor = null; } } - private static ExecutorService getInVMExecutor() { + private static synchronized ExecutorService getInVMExecutor() { if (threadPoolExecutor == null) { if (ActiveMQClient.globalThreadMaxPoolSize <= -1) { threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), Executors.defaultThreadFactory()); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index fc4d957f025..c9824a04ed2 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -234,7 +234,6 @@ public void tearDown() throws Exception { closeAllServerLocatorsFactories(); try { - assertAllExecutorsFinished(); assertAllClientConsumersAreClosed(); assertAllClientProducersAreClosed(); assertAllClientSessionsAreClosed(); @@ -275,6 +274,7 @@ public void tearDown() throws Exception { s.shutdown(); } InVMConnector.resetThreadPool(); + assertAllExecutorsFinished(); //clean up pools before failing