[
https://issues.jboss.org/browse/CDI-601?page=com.atlassian.jira.plugin.sy...
]
Martin Kouba commented on CDI-601:
----------------------------------
To sum it up, right now if we have an {{@ApplicationScoped}} bean and want to perform some
cleanup before it's destroyed:
* use {{@PreDestroy}} callback - this can only be used to perfom "local" cleanup
as we should NOT call other {{@ApplicationScoped}} beans from within the callback (the
ordering of destruction is not defined)
* observe {{(a)Destroyed(ApplicationScoped.class)}} which should be fired _"when the
application is destroyed"_; but this could be tricky - see also CDI-625
I believe we should either clarify that {{(a)Destroyed(X.class)}} is fired before the
context is destroyed (CDI-625) or introduce a new regular event {{ApplicationStopped}}
when an application is stopped, before the container destroys all contexts.
Add container lifecycle event fired before container destroys all
contexts
--------------------------------------------------------------------------
Key: CDI-601
URL:
https://issues.jboss.org/browse/CDI-601
Project: CDI Specification Issues
Issue Type: Feature Request
Reporter: Martin Kouba
Fix For: 2.0 (discussion)
The name might be something like {{BeforeContainerShutdown}}. Note that we probably
cannot change the name or semantics of {{BeforeShutdown}}, which is fired after container
destroys all contexts. The motivation is to allow the beans to perform some kind of
cleanup before dependencies could be disposed (the ordering of destruction is not
defined).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)