Announcement Announcement Module
Collapse
No announcement yet.
DefaultMessageListenerContainer clean stop Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultMessageListenerContainer clean stop

    I am getting the following tomcat issue when my web app gets redepolyed:
    SEVERE: The web application [/myApp] appears to have started a thread named [InactivityMonitor Async Task: java.util.concurrent.ThreadPoolExecutor$Worker@40f 92a41] but has failed to stop it. This is very likely to create a memory leak.

    This is how I construct the DefaultMessageListenerContainer in the applicationContext.xml:
    Code:
    <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer" id="jmsContainer">  
        <property name="connectionFactory" ref="cachedConnectionFactory"></property>  
        <property name="destination" ref="myTopic"></property>  
        <property name="messageListener" ref="myMessageListener"></property>  
        <property name="sessionTransacted" value="true" />
        <property name="subscriptionDurable" value="true"/>
      </bean>
    How do I ensure that the MessageListener thread is properly stopped when the app stops?

    Thanks

  • #2
    How are you instantiating the application context?

    Comment


    • #3
      Originally posted by Gary Russell View Post
      How are you instantiating the application context?
      Since I am new to Spring I am not quite sure what u mean - it gets loaded by default when the web.xml loads the org.springframework.web.context.ContextLoaderListe ner

      Comment


      • #4
        That's the answer I was looking for (I just wanted to be sure you weren't controlling the context's lifecycle yourself).

        Every thing should stop just fine; is it possible you are processing a message during termination?

        I suggest you run with TRACE level logging and take a look at the log.

        Comment


        • #5
          Originally posted by Gary Russell View Post
          That's the answer I was looking for (I just wanted to be sure you weren't controlling the context's lifecycle yourself).

          Every thing should stop just fine; is it possible you are processing a message during termination?

          I suggest you run with TRACE level logging and take a look at the log.
          I added closeAsync=false to the brokerURL - as follows:

          Code:
          <bean id="activeMQConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
          		<property name="brokerURL" value="tcp://localhost:61616?closeAsync=false"/> 
          		<property name="clientID" value="evrClientID"/>	 
                   </bean>
          <bean class="org.springframework.jms.connection.CachingConnectionFactory" id="cachedConnectionFactory"        p:sessionCacheSize="10"
                  p:targetConnectionFactory-ref="activeMQConnectionFactory" >
              </bean>
          & then when I republished my web app to tomcat I no longer see that Severe warning coming up - is that ok to do - I am not quite sure why this supposedly fixed it or is it just a temporary fix?

          Comment


          • #6
            That makes sense; just a timing problem; sync close should do it (or simply ignore the message).

            Comment


            • #7
              Originally posted by Gary Russell View Post
              That makes sense; just a timing problem; sync close should do it (or simply ignore the message).
              Thanks alot for all your help - I really appreciate it

              Comment

              Working...
              X