Nic Ferrier wrote:
>
> >>> "Christopher K. St. John" <[EMAIL PROTECTED]> 02-Nov-00 11:12:01 PM
> >>>
>
> >Example: On shutdown, the version of Tomcat I'm running
> >calls all the servlet destroy() methods in order, in the
> >same thread. A servlet with an unbounded wait in destroy()
> >will delay the shutdown calls to all the other servlets.
> >Coding the container to allow for that possibility is a
> >royal pain, especially since I suspect there's no 100%
> >pure java solution that will solve the problem.
>
> I do see your point... though I can't see why a container couldn't
> establish a new thread to do shutdowns (perhaps you'd like to add that
> to Paperclips?).
>
It could, but even that doesn't actually solve the problem.
Imagine if the servlet decided to sleep forever in destroy(),
catching InterruptedExceptions and looping back to sleep()
some more. There isn't, as far as I can tell, a 100% pure
java way to make it stop. Thread::stop() is deprecated, and
System::exit() isn't pure java. "Best" solution is maybe the
thread-per-destroy thing and then setup a timer and after it
expires, do a System.exit(). But that's a lot of extra complexity,
and I wonder whether it's really worth it for what amounts
to a partial hack of a solution.
The same sort of problem can happen if, say, you're using
a threadpool and one servlet's doGet() blocks for a long
time. Eventually that will run your threadpool down and
you're stuck. Since java can't do anything about it, it's
like you're back in the the (shudder) days of cooperative
multitasking: the servlet has to follow the rules or else.
You might get around that by allocating pools-per-context,
but it just starts to get silly after a while, and you have
to ask if it's worth it.
> >I think this gets back to the difference between servlets-
> >as-http-front-ends and servlets-as-self-contained-webapps.
> >A webapp shouldn't contain resources that have a different
> >lifetime than the webapp itself.
>
> This is the root problem. I had a conversation with Danny Coward (Sun
> Servlet spec maestro) recently about this. My view is that Servlets
> are being pulled in different directions by ejb people and java-cgi
> people (I'm in the latter camp).
>
> Danny suggested that Servlets could be a framework for both but
> there's a long road before we get there.
>
> I hope he's right.
>
Me too...
-cks
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html