This closes #475

This commit is contained in:
Martyn Taylor 2016-04-20 14:05:17 +01:00
commit cb8d3b78e6
2 changed files with 3 additions and 3 deletions

View File

@ -94,14 +94,14 @@ public class InVMConnector extends AbstractConnector {
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<Runnable>(), Executors.defaultThreadFactory());

View File

@ -234,7 +234,6 @@ public abstract class ActiveMQTestBase extends Assert {
closeAllServerLocatorsFactories();
try {
assertAllExecutorsFinished();
assertAllClientConsumersAreClosed();
assertAllClientProducersAreClosed();
assertAllClientSessionsAreClosed();
@ -275,6 +274,7 @@ public abstract class ActiveMQTestBase extends Assert {
s.shutdown();
}
InVMConnector.resetThreadPool();
assertAllExecutorsFinished();
//clean up pools before failing