Announcement Announcement Module
Collapse
No announcement yet.
java process won't stop? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java process won't stop?

    I've just integrated sprint integration into a local java app... I have all the beans pulled into a separate xml file. If I include that xml in springs startup, the java process never stops. If I remove that file, it ends normally. I took a thread dump and noticed there were quite a few activemq and jms threads still running (although, interestingly, the main thread was done.)

    Any ideas? Do I need to configure anything to shutdown cleanly?

    thanks
    sam

    ps - this is the thread I'm concerned about.

    Code:
    "org.springframework.jms.listener.DefaultMessageListenerContainer#0-1" prio=6 tid=0x39a32400 nid=0x12a4 waiting on condition [0x3b08f000..0x3b08fd14]
       java.lang.Thread.State: TIMED_WAITING (sleeping)
    	at java.lang.Thread.sleep(Native Method)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer.sleepInbetweenRecoveryAttempts(DefaultMessageListenerContainer.java:837)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:807)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:767)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:898)
    	- locked <0x09667718> (a java.lang.Object)
    	at java.lang.Thread.run(Thread.java:619)
    
       Locked ownable synchronizers:
    	- None

  • #2
    Those processes run in their own threads (not main) and intentionally keep running in the background. Everything should shutdown gracefully if you call context.close() or context.stop() on the ApplicationContext itself. You can also register a shutdown hook.

    Comment


    • #3
      I added a finally clause to the main method of each of my applications to close the context... that seemed to do the trick. I really liked the idea of the shutdown hook, since I had multiple applications to fix, but that didn't work. The shutdown hook never got called. (Possibly because the messaging thread is not a daemon thread, and the shutdown hook only gets called when all the non-daemon threads stop.)

      anyway, thanks for the help. I think I'm all set now.
      sam

      Comment

      Working...
      X