Use Singleton bean and implement PreDestroy.
Use @Singleton bean and implement @PreDestroy: @Startup @Singleton public class HookBean { @PreDestroy void wholeApplicationShuttingDown { } } UPDATE: Just noticed ejb-3.0 tag. @Singleton was added in 3.1. But still maybe you will find it useful.
Will see if I can upgrade JBoss 5.1 to support ejb3.1 and try it. – n002213f Sep 30 at 8:55 @n002213f well then you should at least upvote his answer! – Sean Patrick Floyd Sep 30 at 8:57.
Use a Stateless Bean with a @PreDestroy method.
2 Won't work. Stateless beans are pooled - there might be several instances of such a bean or none - if they weren't used. Also you have no guarantee that the container will not destroy all the instances in the pool e.g.In the middle of night just because they weren't used lately.
– Tomasz Nurkiewicz Sep 29 at 20:06 @TomaszNurkiewicz Quote from the link above: "Because a stateless session bean is never passivated, its lifecycle has only two stages: nonexistent and ready for the invocation of business methods. " – Sean Patrick Floyd Sep 29 at 20:12 1 I can feel your pain ;-). And yes, with Spring simple @PreDestroy method on non-lazy bean does the trick... Actually the @Singleton and @Startup annotations were introduced in EJB 3.1 exactly to solve the issue OP is having (there was no reliable startup callback as well...) – Tomasz Nurkiewicz Sep 29 at 20:39 1 @TomaszNurkiewicz sorry, I was blind :-) – Sean Patrick Floyd Sep 29 at 21:18 1 thank you all for the suggestions, will try upgrading to ejb3.1 and us the Singleton.
– n002213f Sep 297 at 8:56.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.