Description of problem: EJB @PreDestroy not called when AS/EAP stopped Version-Release number of selected component (if applicable): How reproducible: 100% Steps to Reproduce: 1. Create AS/EAP app 2. Deploy app with EJBs w/@PreDestroy method 3. Stop AS/EAP Actual results: @PreDestroy not called Expected results: @PreDestroy should be called Additional info: Likely caused by killing the process tree vs calling shutdown
Forum link: https://openshift.redhat.com/community/forums/openshift/predestroy-not-called-on-my-singleton-ejb#comment-25467
Use kill -9 instead of kill - TERM if graceful shutdown fails
Moved during bug triage meeting
Created attachment 771201 [details] Lifecycle demo code
I'm closing this issue as NOTABUG, and have attached example code which can be added to a jbossas-7 application demonstrating the lifecycle methods. The code provides a LifecycleDemo class which is a @Singleton/@Startup EJB. When the example code is built and deployed, the following output will appear in the JBoss server.log during startup, demonstrating @PostConstruct: 2013/07/09 15:34:41,027 INFO [stdout] (MSC service thread 1-1) !!!!!!!!!!! in postconstruct When an `rhc app stop` is issued to the application, the following output will appear in the JBoss boot.log demonstrating @PreDestroy: 15:34:59,821 INFO [stdout] !!!!!!!!!!! in predestroy The jbossas-7 cartridge issues a SIGTERM to the container for shutdown, which is equivalent to using the JBoss CLI 'shutdown' command. This is a graceful shutdown, and the lifecycle is honored in both cases.