本文介绍了主线程结束时 ActiveMQ 传输线程不会终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我开始连接的方式:
This is how I start connection:
factory = new PooledConnectionFactory(brokerURL);
brokerURL is "failover:(tcp://host1.com:61616,tcp://host2.com:61616)?randomize=false&jms.useAsyncSend=false&jms.dispatchAsync=false&maxReconnectAttempts=30&maxReconnectDelay=3000"
连接开始:
connection = factory.createConnection("", "");
connection.start();
应用程序在连接关闭之前执行其通常的任务:
Application performs its usual tasks before connections gets closed:
connection.close();
main 方法完成了,但 JVM 没有完成,因为还有几个 ActiveMQ 线程处于活动状态:
main method is finished, but JVM is not, because there are still a few ActiveMQ threads active:
Thread [ActiveMQ Transport: tcp://host1.com/ip_address:61616@2455] (Running)
Daemon Thread [ActiveMQ InactivityMonitor ReadCheckTimer] (Running)
Daemon Thread [ActiveMQ InactivityMonitor WriteCheckTimer] (Running)
Daemon Thread [ActiveMQ InactivityMonitor Worker] (Running)
我应该如何关闭它以便上面的线程也将关闭.ActiveMQ 5.10.0 版
How am I supposed to close it so that the threads above will shutdown too.ActiveMQ version 5.10.0
提前致谢
推荐答案
Fixed with (PooledConnectionFactory) factory).stop();
Fixed with (PooledConnectionFactory) factory).stop();
这篇关于主线程结束时 ActiveMQ 传输线程不会终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!