Bug 884684 - EJB @PreDestroy not called when AS/EAP stopped
Summary: EJB @PreDestroy not called when AS/EAP stopped
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: ---
Assignee: Dan Mace
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-06 14:51 UTC by Bill DeCoste
Modified: 2015-05-14 23:17 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-09 19:41:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Lifecycle demo code (13.31 KB, application/zip)
2013-07-09 19:37 UTC, Dan Mace
no flags Details

Description Bill DeCoste 2012-12-06 14:51:42 UTC
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

Comment 2 Bill DeCoste 2013-02-21 00:39:08 UTC
Use kill -9 instead of kill - TERM if graceful shutdown fails

Comment 3 Mike McGrath 2013-06-24 19:34:16 UTC
Moved during bug triage meeting

Comment 4 Dan Mace 2013-07-09 19:37:38 UTC
Created attachment 771201 [details]
Lifecycle demo code

Comment 5 Dan Mace 2013-07-09 19:41:00 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.