Notice that server life cycle listeners normally work in the server context, 
and not in a war file class loader. This may cause some problems for code in 
the war file accessing the objects that were created by the listener.

Something else that you should consider in tomcat 5.x versions is the shutdown, 
which may cause requests to be processed in the middle of shutdown, after some 
components were already stopped (meaning their shutdown callback method was 
called, and they released their resources). In JNDI it will cause released 
objects to re-instantiate themselves. So if you see your thread pool restarting 
after you issue a shutdown command under load, don't be surprised. The safest 
way I know around it is not have container based shutdown methods on the 
objects. Instead have a server lifecycle listener shut them down using 
proprietary methods that are not defined by the container interfaces (which you 
should implement as empty methods).

E

----- Original Message -----
From: Anup K Ram <anupk...@gmail.com>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Thu, 22 Oct 2009 20:58:37 -0700 (PDT)
Subject: Re: How to know when tomcat is ready to serve request

My problem here is I want to wake up the thread after the server is
completely started. I have not used Server LifeCycleListener before. I will
give it a try. Appreciate any help. Thanks.

On Thu, Oct 22, 2009 at 7:48 PM, Elli Albek <e...@sustainlane.com> wrote:

> If this is the case you can assume that the war file is deployed.
>
> I don't trust the code of the tomcat startup/shutdown. If you want to be
> 100% safe use a server lifecytle listener. This is limited to a server that
> has the same apps, meaning you are not adding/removing/replacing
> applications on the fly. There is a higher probability that what you assume
> is "running" and "not running" based on event listeners is correct with
> lifecycle listener (higher, not 100%). This is for tomcat 5.x. in 6.x
> versions the event and lifecycle management may mirror more the actual
> lifecycle of objects.
>
> E
>
>
> ----- Original Message -----
> From: "Anup K Ram" <anupk...@gmail.com>
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Sent: Thursday, October 22, 2009 9:38:01 AM (GMT-0800) America/Los_Angeles
> Subject: Re: How to know when tomcat is ready to serve request
>
> The code is in a thread thats in turn spawned from the contextInitilized
> method of a ServletContextListener.(Inside the war)
>
> On Wed, Oct 21, 2009 at 11:53 PM, Elli Albek <e...@sustainlane.com> wrote:
>
> > Where does the code that needs to know that reside? How is it
> initialized?
> > Is it inside tomcat (war file, valve, JNDI resource) or outside the
> tomcat
> > JVM?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to