Issue Type: Bug Bug
Affects Versions: 2.1.1.Final
Assignee: Jozef Hartinger
Created: 31/Dec/13 1:44 PM
Description:

From the commit comment for pull request #444 (https://github.com/weld/core/pull/444)

The shutdown hook needs to be registered with the JVM before the Weld container is initialized. Without the shutdown hook, the following problems occur (or can occur):

  • System.exit(0) will terminate the program without any @PreDestroy or @Disposes methods being called.
  • CTRL-C will terminate the program without any @PreDestroy or @Disposes methods being called.
  • SIGTERM will terminate the program without any @PreDestroy or @Disposes methods being called.
  • Normal completion of methods that @Observes the ContainerInitialized events (effectively the program's entry points) will not call @PreDestroy or @Disposes methods unless they're @ApplicationScoped.
  • Since calling addShutdownHook() is not permitted once the JVM has started the shutdown process, multi-threaded applications can allow the main thread to return to StartMain while the JVM is still running. Executing addShutdownHook() in this instance will throw an IllegalStateException.

The problem described in this thread (https://community.jboss.org/thread/180032?start=0&tstart=0) may be related.

Project: Weld
Priority: Major Major
Reporter: Steve Moyer
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira