firstly ,it's my code ,and setuptopic() and disconnectAndDestroyAllNotificationReceivers() will be invoked by another Jmx: MBean .connect() and disconnect() seperately.
in another word ,I will invoke these two methods by Jmx Manage Bean .
public void setupTopic() throws JMSException, NamingException {
iniCtx = new InitialContext();
Object tmp = iniCtx.lookup("ConnectionFactory");
String alarmTopicName ="topic/ALARMNOTIFICATIONS";
String connectStatusTopicName ="topic/OSNOTIFICATIONS";
TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
//topic = (Topic) iniCtx.lookup(alarmTopicName);
topic2 = (Topic) iniCtx.lookup(connectStatusTopicName);
conn = tcf.createTopicConnection();
session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
conn.start();
connectHealthReceiver();
}
public void disconnectAndDestroyAllNotificationReceivers() {
try {
//topicSubscriber.setMessageListener(null);
session.close();
conn.stop();
iniCtx = null;
conn = null;
session = null;
topic = null;
topic2 = null;
System.gc();
} catch (Exception e) {
e.printStackTrace();
}
}
Thread[UIL2.SocketManager.ReadTask#9 client=192.168.71.73:xxxx](Running)
Thread[UIL2.SocketManager.ReadTask#10 client=192.168.71.73:xxxx](Running)
Thread[UIL2.SocketManager.ReadTask#11 client=192.168.71.73:xxxx](Running)
Thread[UIL2.SocketManager.ReadTask#12 client=192.168.71.73:xxxx](Running)
Thread[UIL2.SocketManager.MsgPool@xxxx)#1]