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 0783d7c0a9..c222d0d8c2 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,6 +94,13 @@ public class InVMConnector extends AbstractConnector { private static ExecutorService threadPoolExecutor; + public static void resetThreadPool() { + if (threadPoolExecutor != null) { + threadPoolExecutor.shutdown(); + threadPoolExecutor = null; + } + } + private static ExecutorService getInVMExecutor() { if (threadPoolExecutor == null) { if (ActiveMQClient.globalThreadMaxPoolSize <= -1) { 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 4fd98db13d..13868b2171 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 @@ -96,6 +96,7 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice; import org.apache.activemq.artemis.core.postoffice.QueueBinding; import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; +import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnector; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMRegistry; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; @@ -235,6 +236,8 @@ public abstract class ActiveMQTestBase extends Assert { closeAllSessionFactories(); closeAllServerLocatorsFactories(); + InVMConnector.resetThreadPool(); + try { assertAllExecutorsFinished(); assertAllClientConsumersAreClosed();