Results 1 to 7 of 7

Thread: DefaultMessageListenerContainer clean stop

  1. #1
    Join Date
    Jun 2012
    Posts
    19

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,040

    Default

    How are you instantiating the application context?
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Jun 2012
    Posts
    19

    Default

    Quote 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

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,040

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Jun 2012
    Posts
    19

    Default

    Quote 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?

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,040

    Default

    That makes sense; just a timing problem; sync close should do it (or simply ignore the message).
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  7. #7
    Join Date
    Jun 2012
    Posts
    19

    Default

    Quote 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •