[I seem to be getting very delayed emails from the list; if this has already 
been answered, ignore me!]

> From: André Warnier [mailto:a...@ice-sa.com]
> suppose there are 3 active
> servlets (processing requests) at the moment the request to
> undeploy is
> issued by one of them.  The servlet issuing the undeploy request knows
> that it has asked for it, so it can take any appropriate measures to
> terminate itself cleanly and quickly.
> Which leaves the other two (I am using two intentionally,
> because there
> is only one call to the ServletContextListener; it avoids cheating).
> How do they know ?

That's up to you, as the application developer.  It depends how tight a 
coupling you want between the servlets, and how much configuration you want in 
web.xml.

> Would that be like positioning some variable somewhere, accessible to
> all the servlets belonging to that same webapp, which they can check
> from time to time ?

That works.

> Or does one have to implement in each servlet some
> kind of callback routine that the ContextDestroy can call ?

That works too.  Or if they were genuinely independent servlets that happened 
to be bundled into the same webapp, I think you could choose to register three 
listeners so that each of the three got an appropriate ContextDestroy call?

> And, does that tie into the fact that all the servlets of a
> same webapp,
> by virtue of sharing the same classloader, can actually share
> something?

They share classes, and hence they can share (say) a singleton or a static 
variable.

> And, does that somehow relate to what the original OP of another
> thread, who was talking about a "static variable" being set
> when Tomcat is shut down, meant ?

Probably :-).

                - Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to