You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michelle <mi...@onclave.com> on 2000/10/12 21:34:39 UTC

keep servlet loaded

Hi, apologies if this is addressed somewhere and I cannot find it
....

I understand that I can preload my servlet by defining an entry in
the webapp/web.xml.  Is there a way to tell Tomcat to keep a servlet
loaded at all times?

Thanks.


Re: [tomcat-user] keep servlet loaded

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
kenneth topp wrote:

> Argh... I didn't care for the startup race conditions that I've witnessed
> in java app server that supports something like this.  They were numerous,
> and difficult to deal with.  Hopefully this code will be _very_ careful
> not to repeat the same mistakes.
>

For the application startup and shutdown events, you're guaranteed by the spec
that they will be called from a single thread, in the order listed in the
deployment descriptor.  Does that solve the problems you were seeing?


>
> Kenneth Topp
>

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Re: [tomcat-user] keep servlet loaded

Posted by kenneth topp <ca...@prodigy.net>.
Argh... I didn't care for the startup race conditions that I've witnessed
in java app server that supports something like this.  They were numerous,
and difficult to deal with.  Hopefully this code will be _very_ careful
not to repeat the same mistakes.

Kenneth Topp

---
 to unsubscribe: tomcat-user-unsubscribe@jakarta.apache.org
 for more info: http://jakarta.apache.org/getinvolved/mail.html


On Thu, 12 Oct 2000, Craig R. McClanahan wrote:

> Michelle wrote:
> 
> > Hi, apologies if this is addressed somewhere and I cannot find it
> > ....
> >
> > I understand that I can preload my servlet by defining an entry in
> > the webapp/web.xml.  Is there a way to tell Tomcat to keep a servlet
> > loaded at all times?
> >
> 
> There are no guarantees in the servlet specification that a servlet will
> stay loaded at all times (although Tomcat currently does leave it loaded
> until you restart that application or shut down the server).  It is
> within the rights of the servlet container, though, to destroy your
> servlet instance at any time it wants to, and create a new instance
> later when another request comes in.
> 
> This is one of the reasons that application events were added to the
> Servlet 2.3 specification (supported by Tomcat 4.0).  You can now
> register a class that receives notifications when the application is
> first started up, and when it is shut down.  This is perfect for
> creating application-wide resources (such as a database connection pool)
> at startup time, and guaranteeing that those resources will be available
> through the life of the application.
> 
> >
> > Thanks.
> 
> Craig McClanahan
> 
> ====================
> See you at ApacheCon Europe <http://www.apachecon.com>!
> Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
> Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
>                                     Applications to Tomcat
> 
> 


Re: keep servlet loaded

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Michelle wrote:

> Hi, apologies if this is addressed somewhere and I cannot find it
> ....
>
> I understand that I can preload my servlet by defining an entry in
> the webapp/web.xml.  Is there a way to tell Tomcat to keep a servlet
> loaded at all times?
>

There are no guarantees in the servlet specification that a servlet will
stay loaded at all times (although Tomcat currently does leave it loaded
until you restart that application or shut down the server).  It is
within the rights of the servlet container, though, to destroy your
servlet instance at any time it wants to, and create a new instance
later when another request comes in.

This is one of the reasons that application events were added to the
Servlet 2.3 specification (supported by Tomcat 4.0).  You can now
register a class that receives notifications when the application is
first started up, and when it is shut down.  This is perfect for
creating application-wide resources (such as a database connection pool)
at startup time, and guaranteeing that those resources will be available
through the life of the application.

>
> Thanks.

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat