You can't rely on the destroy() method on the servlet for this purpose. The
container has the right to unload servlets when it chooses as a part of
resources management. If you are using a servlet 2.3 spec container use the
ServletContextListener as Jake suggests.

<flame-retardent-suit>
Death to all load on startup servlets ;)
</flame-retardent-suit>

Jon

-----Original Message-----
From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
Sent: 07 October 2002 16:07
To: Tomcat Users List
Subject: Re: Action on close


Yep,

Servlet 2.3 introduced the concenpt of the ServletContextListener which
contains
 contextInitialized() and contextDestroyed() which are guaranteed to be
loaded
once at startup and once at shutdown, respectively.

You just need a class that implements ServletContextListener and specify it
in
the web.xml as:

<listener>
        <listener-class>
        org.myapp.listeners.MyServletContextListener
        </listener-class>
</listener>

There you go.

Jake

Quoting David Mossakowski <[EMAIL PROTECTED]>:

> There's a destroy() method called on a servlet when it is unloaded from
> Tomcat.  You can't depend on that to mean that Tomcat is shutting down
> but maybe it could be helpful.
>
> d.
>
> Yuriy Stul wrote:
> > Hello,
> > it is possible to specify a class what must be called (loaded) on
startup
> > (web.xml, <servlet> <load-on-startup> ...). It is working fine.
> >
> > My question is it possible to specify any servlet what will be loaded
> before
> > Tomcat shutdown?
> >
> > Thanks in advance
> >
> > ================
> > Regards,
> >    Yuriy
> > Sr. Software Eng.
> > <mailto:[EMAIL PROTECTED]>
> > http://www.bladefusion.com
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> >
>
>
> --
> David Mossakowski              [EMAIL PROTECTED]
> Instinet Corporation                 212.310.7275
>
>
>
>
****************************************************************************
***
> <<Disclaimer>>
>
> This message is intended only for the use of the Addressee and
> may contain information that is PRIVILEGED and/or
> CONFIDENTIAL or both.
>
> This email is intended only for the personal and confidential use
> of the recipient(s) named above.
>
> If the reader of this email is not an intended recipient, you have
> received this email in error and any review, dissemination,
> distribution or copying is strictly prohibited.
>
> If you have received this email in error, please notify the sender
> immediately by return mail and permanently deleting the copy
> you received.
>
> Thank you.
>
>
****************************************************************************
***
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to