Instead of looking for something Tomcat/Serlvet2.2 specific, how about
using Runtime.addShutdownHook(Thread)?

My vm version is 1.2.2 so I have not been able to use this new feature.
I was forced to use the (deprecated) Runtime.runFinalizersOnExit()
method instead.

Let me know if you have any luck with addShutdownHook().

hth,
-Duck

-----Original Message-----
From: Daniel Lopez [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 14, 2001 11:41 AM
To: [EMAIL PROTECTED]
Subject: Re: detecting shutdown


Hi David,

AFAIK there's no such a thing in any servlet container that I've worked
with,
but I might be wrong as my experience with Tomcat is quite limited.
However,
this wouldn't be a logical option as the same that you say about
unloaded!=tomcat stopping can be said of loaded. AFAIK loaded!=Tomcat
just
started but it just means tomcat just loaded the servlet. Thus, if
Tomcat
decides to unload/reload your servlet for any reason and then tomcat is
stopped
you would end up with multiple initialisations and just one
finalisation.
Ummm, I think that with JSDK 2.3 you might try to do what yoy want with
the
class ServletContextListener, which is notified when the context is
initialised
or destroyed. With JSDK 2.2 I'm not sure how could one verify that
everything is
really shutting down before clearing things up. We solved it by using
just ONE
servlet which acts as ServletController and who initialises everything
when
being loaded and cleans everything when unloaded, but I understand this
is not a
general solution.
I'm afraid I can't help you much with JSDK2.2. May be someone out there?
;)
regards,
Dan

David Wall wrote:

> Is there something like the web.xml's "load on startup" that can be
> triggered when the Tomcat has been requested to shutdown?  I'd like to
be
> able to do "global" cleanup in such a situation.
>
> I know that an unloaded servlet will be called, but it's not true that
being
> unloaded means that Tomcat is stopping.
>
> Thanks,
> David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to