tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: keep servlet loaded
Date Thu, 12 Oct 2000 19:43:05 GMT
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 <>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

View raw message