You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anand Raman <ar...@india-today.com> on 2000/04/18 15:04:11 UTC

Is it OK to destroy a servlet

Hi guys
I experienced some problem with  automatic reloading of a servlet so i
coded a if condition in the servlet which will self destruct the code if
it found the source file is newer than the servlet compiled class file.
I want to know if it is OK to do so
Thanx for ur time
Anand

--
I have no idea how this happened. As a consumer, I don't really care.



Re: Is it OK to destroy a servlet

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Anand Raman wrote:

> Hi guys
> I experienced some problem with  automatic reloading of a servlet so i
> coded a if condition in the servlet which will self destruct the code if
> it found the source file is newer than the servlet compiled class file.
> I want to know if it is OK to do so
> Thanx for ur time

You should *never* call the init() or destroy() methods of your servlet
yourself.  In your case, if you call destroy() yourself then your servlet
thinks it has been shut down, but the servlet container does not know this -
it will keep sending you requests.

NOTE:  there was a very recent bug fix to Tomcat 3.1rc1 that makes it call
destroy() when doing the automatic reload trick -- this fix will be in the
final release.  Be sure you read the release notes (file "doc/readme" in the
distribution) for more information on this feature.


> Anand
>

Craig McClanahan