views:

93

answers:

2

Hi all,

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.

My 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

+1  A: 

How about considering ServletContextListener, in the first place?

Adeel Ansari
Hmm, good point. I've used that in the past (Spring apps) and that is standard J2EE practice. I'll give that a try, I didn't think of that to be honest. I only wonder if it will be in a Seam Context. I'll give that a try and let you know.
+1  A: 

Hi all,

Actually, there is a JIRA issue filed for this problem. Two things are wrong.

  1. An application-scoped component with a remove/destroy method does not execute properly without an active event scope.
  2. 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

@Walter White Good to know (+1)
Arthur Ronald F D Garcia