mirror of https://github.com/apache/activemq.git
AMQ-3451: Ensure thread pools is shutdown properly to avoid any leaks. Do not use the old @deprecated thread pool.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1381991 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4e1989247e
commit
aa6a6d73e5
|
@ -30,7 +30,6 @@ import org.apache.activemq.ActiveMQConnectionFactory;
|
|||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.bugs.embedded.ThreadExplorer;
|
||||
import org.apache.activemq.network.NetworkConnector;
|
||||
import org.apache.activemq.thread.DefaultThreadPools;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -93,21 +92,17 @@ public class VmTransportNetworkBrokerTest extends TestCase {
|
|||
broker.stop();
|
||||
broker.waitUntilStopped();
|
||||
|
||||
// must only be called when all brokers and connections are done!
|
||||
DefaultThreadPools.shutdown();
|
||||
|
||||
// let it settle
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
|
||||
// get final threads but filter out any daemon threads that the JVM may have created.
|
||||
Thread[] threads = filterDaemonThreads(ThreadExplorer.listThreads());
|
||||
int threadCountAfterStop = threads.length;
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(ThreadExplorer.show("active after stop"));
|
||||
LOG.debug("originalThreadCount=" + originalThreadCount + " threadCountAfterStop=" + threadCountAfterStop);
|
||||
}
|
||||
|
||||
|
||||
// lets see the thread counts at INFO level so they are always in the test log
|
||||
LOG.info(ThreadExplorer.show("active after stop"));
|
||||
LOG.info("originalThreadCount=" + originalThreadCount + " threadCountAfterStop=" + threadCountAfterStop);
|
||||
|
||||
assertTrue("Threads are leaking: " +
|
||||
ThreadExplorer.show("active after stop") +
|
||||
". originalThreadCount=" +
|
||||
|
|
Loading…
Reference in New Issue