tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "eric chacon" <>
Subject Re: Correct way to have a servlet exit ???
Date Wed, 09 May 2001 12:43:14 GMT
I don't know if it's safe to call destroy() -- it occurs to me that that 
might be App Server dependent (I'd have to check the spec to be sure).

You might not want to do that though, depending on what the problem was:

If the servlet cannot find a config file, you might want it start up in a 
crippled "report error" mode, where it would direct all requests to an error 
page ("This System is Experiencing Technical Difficulties"), and uses some 
kind of reporting mechanism to alert the administrators.

If the resources it's missing are critical to the entire system (memory, for 
example, or database access), then recovery isn't really an option, and it 
doesn't much matter how you exit an individual servlet.

I've had lots of problems of these kinds (I'm using these IBM-created XML 
servlet classes, where each servlet has an XML config file), and the 
"re-direct-to-the-error-page" system worked pretty well for me.


>From: "Hawkins, Keith (Keith)" <>
>To: "tomcat-user" <>
>Subject: Correct way to have a servlet exit ???
>Date: Wed, 9 May 2001 08:26:43 -0400
>If a servlet encounters a problem on startup (e.g. can't find a config
>file) how should the servlet gracefully exit?
>Is it safe to call its own destroy() method?   Will that confuse/damage
>the servlet container?

Get your FREE download of MSN Explorer at

View raw message