0 Replies Latest reply on Apr 12, 2006 4:05 PM by vincent.yuan

    repeatedly connect createSubscriber ,close ,stop,I found the

    vincent.yuan

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



      then please care the following diagram:

      [img]http://vip.sina.com.cn/cgi-bin/album/ualimage.cgi?egp=nq7sGp139DGG99GG3vRGvmCCsszmG9mfs9k&al=0&ph=14&brev=0[/img]
      once I disconnect and then connect again.(invoke setupTopic)
      the following threads will be added .(of courese ,#n will keep increasing).
      but after I disconnect ,all these threads never be released(disappear),

      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)

      I am worried this will impact on the performance of Jboss.
      I want to learn what 's those threads ,
      how to get rid of them after I disconnect from Jms.

      the following threads will be released by jboss and disappear.
      name like
      Thread[UIL2.SocketManager.MsgPool@xxxx)#1]