users@glassfish.java.net

Re: [urgent] problem in starting server when the app already

From: <glassfish_at_javadesktop.org>
Date: Sun, 31 Aug 2008 16:01:14 PDT

I know that they're looking at lifecycle issues in the next version of EJB, but I don't know the details.

Spawning would be creating a new thread to run your initialization rather than relying on the current thread. The problem with suspending the current thread is that there may well be something that the current thread is blocking that is causing this deadlock -- so suspending the thread just lengthens the dead lock, it doesn't resolve it.

By spawning a new thread, the current thread can continue and, ideally, release whatever it is that may be causing the hang up, while the new thread continues trying to initialize the resource, and even perhaps retrying should it run in to errors.

The downside is that you are no longer assured that once your ContextListener has exited, everything is initialized -- the new thread may very well still be running and waiting on resources.

So, it's definitely a nasty problem, and fixing one race condition with perhaps another isn't really the best way to solve things. But it may actually work.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=296441