+++ This bug was initially created as a clone of Bug #957689 +++ Description of problem: When the server is shutdown, several components (datasources, ejbs) go down before RHQ's shutdown listener code completes. Version-Release number of selected component (if applicable): 4.6 How reproducible: Always Steps to Reproduce: 1. Add a 'Thread.sleep' statement in Data Purge Job code 2. Change the scheduling code to start the Data Purge Job 30 seconds after server startup 2. Rebuild, start, wait and stop the server when purge job is executed Actual results: Errors in the server log: http://pastebin.test.redhat.com/138892 Expected results: The server should not go down until data purge job and shutdown listener code finish. Additional info: To be verified: it looks like AS7, unlike AS 4.2.3, does not wait for our Shutdown listener code to complete execution before shutting down all resources (datasources, EJBs, etc...) --- Additional comment from Thomas Segismont on 2013-04-30 15:29:02 CEST --- Before RHQ4.6, shutdown listener was implemented as a JMX notification listener. Now it is implemented as a Singleton bean and shutdown logic is in the @PreDestroy method. It's not really needed to hack the Data Purge Job code to show this. Almost always, when you hit Ctrl-C on a server started in console mode, you'll see the same exception message: javax.ejb.EJBException: JBAS014559: Invocation cannot proceed as component is shutting down This message was introduced in this AS7 pull request: https://github.com/wildfly/wildfly/pull/1889 Calling @EJB methods in @PreDestroy callbacks is normally allowed by the spec. Somebody reported similar (but not same) problem and the issue was accepted and resolved: https://community.jboss.org/message/764240 https://issues.jboss.org/browse/AS7-4808 Note: shutdown notification should come back in Wildfly http://lists.jboss.org/pipermail/jboss-as7-dev/2012-April/005834.html
Fixed in master See comment https://bugzilla.redhat.com/show_bug.cgi?id=957689#c3
Second commit in master See comment https://bugzilla.redhat.com/show_bug.cgi?id=957689#c4
As this is MODIFIED or ON_QA, setting milestone to ER1.