开发者

seam shutdown listener

开发者 https://www.devze.com 2022-12-15 16:42 出处:网络
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.

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.

开发者_如何学C

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


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


How about considering ServletContextListener, in the first place?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号