ARTEMIS-482 Cleanup new ThreadPool on the testsuite to avoid leak report

This commit is contained in:
Clebert Suconic 2016-04-14 23:12:48 -04:00
parent ec73961f72
commit b7118df7d0
2 changed files with 10 additions and 0 deletions

View File

@ -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) {

View File

@ -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();