[wildfly-dev] Intercept server shutdown in Wildfly/EAP6.2

David M. Lloyd david.lloyd at redhat.com
Thu Jan 30 08:48:36 EST 2014


On 01/30/2014 02:50 AM, Marek Neumann wrote:
> Hi experts,
>
> what is the appropriate way to intercept the server shutdown and execute
> some "before-stop" business logic?
>
> I saw https://issues.jboss.org/browse/WFLY-407. Is my assumption correct
> that in EAP6.2 there is no common hook available for a soft server
> shutdown (kill) and a managed shutdown (e.g. via CLI)?
>
> In EAP4.3 we just needed to listen for "org.jboss.system.server.stopped"
> notification sent by the shutdown hook.

Off the top of my head, I think the simplest approach would be to just 
have a singleton EJB with a @PreDestroy in it.

If you don't have EJBs, any deployed bean with lifecycle support will do 
- Servlets, MBeans, jboss-beans-style POJOs.

-- 
- DML


More information about the wildfly-dev mailing list