You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by lb...@GIquadrat.de on 2000/02/07 12:56:52 UTC
Livetime of objects
Hi,
I am currently use tomcat 3.0 without apche server on NT 4.0 SP 5.
I am interested in creating a class that will be started with tomcat. I
have seen that I can write a servlet
(based on GenericServlet or on HttpServlet). But this is a little bit to
much to get an objects livetime up
to that of the server.
How should I do that?
Is there an interface for this?
Thanks
Lothar
Re: Livetime of objects
Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
The init() method of a servlet is called when it is loaded. The 2.2 API
allows you to define each servlet
with a <load-on-startup>x</load-on-servlet> value set, where x is +ve.
See the spec.
e.g.
<servlet>
<servlet-name>something</servlet-name>
<servlet-class>some.thing</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
However, I don't know whether it's actually been implemented in Tomcat
3.0 though the source indicates that it is (however it seems slightly at
odds with the spec as it seems to define 0 as highest priority)
There's no reason why you couldn't have a "loader" servlet with a dummy
service method which just does some stuff when the engine is
initialized.
Fergus
lbehrens@GIquadrat.de wrote:
>
> Hi,
>
> I am currently use tomcat 3.0 without apche server on NT 4.0 SP 5.
>
> I am interested in creating a class that will be started with tomcat. I
> have seen that I can write a servlet
> (based on GenericServlet or on HttpServlet). But this is a little bit to
> much to get an objects livetime up
> to that of the server.
>
> How should I do that?
>
> Is there an interface for this?
>
> Thanks
>
> Lothar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
--
Fergus Gallagher Tel: +44 (20) 89 87 07 17
Orbis Fax: +44 (20) 87 42 26 49
The Swan Centre email: Fergus.Gallagher@orbisuk.com
Fishers Lane Web: http://www.orbisuk.com
London W4 1RX / UK