[weld-commits] [weld/core] b71596: WELD-1579: Weld-SE's shutdown hook fails to dispos...
GitHub
noreply at github.com
Thu Jan 2 10:16:18 EST 2014
Branch: refs/heads/master
Home: https://github.com/weld/core
Commit: b71596dc98fff48de191d40dd219df15611b48e1
https://github.com/weld/core/commit/b71596dc98fff48de191d40dd219df15611b48e1
Author: Steve Moyer <smoyer64 at gmail.com>
Date: 2014-01-02 (Thu, 02 Jan 2014)
Changed paths:
M environments/se/core/src/main/java/org/jboss/weld/environment/se/StartMain.java
M environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Log Message:
-----------
WELD-1579: Weld-SE's shutdown hook fails to dispose of CDI managed objects
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.
More information about the weld-commits
mailing list