I would like to observe when the application is about to shutdown. I thought this code block would work, but it never catches that event.
开发者_如何学CMy component is an event scoped component, I only want it to live for the scope of that event.
@Observer("org.jboss.seam.preDestroyContext.APPLICATION")
@Transactional
public void onShutdown()
{
...
}
Is this possible in the current design of Seam? If not, should this be a feature request or are there other inherit problems with this idea?
Walter
Actually, there is a JIRA issue filed for this problem. Two things are wrong.
- An application-scoped component with a remove/destroy method does not execute properly without an active event scope.
- Any component should be able to observe any event, if the event is synchronous, then the event will be handled first, then that component destroyed.
The application-scoped component is the quickest fix for the time being. The second one will be a bit more complex.
Walter
How about considering ServletContextListener, in the first place?
精彩评论