my dog learned polymorphism*
The moose likes Servlets and the fly likes Unload a servlet in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Unload a servlet in Tomcat" Watch "Unload a servlet in Tomcat" New topic
Author

Unload a servlet in Tomcat

kamalesh radhakris
Greenhorn

Joined: Oct 11, 2005
Posts: 5
Hi,

I implemented a servlet with multi-threading.
When there are too many errors of the servlet, i would like to
unload the servlet form the tomcat container and this should not
disturb other apps running on tomcat.

Tried the destroy() method of the servlet, but did'nt work

My Config
---------
jdk1.4, tomcat 5.5

Please let me know on this.

Thank you in advance,
Regards,
Kam
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Hi kamalesh,

The destroy() method of a servlet does not actually destroy anything. It is a method that is called by the container when the servlet instance is about to be destroyed, and it is there for the developer to insert code to run logic that should run before the instance is destroyed, such as cleaning up resources.

In regards to your question, why are you using a multi threaded servlet? I am not saying this is wrong, but it seems to me that this drastically overcomplicates the application. I would suggest pushing the threading into a helper class and using the servlet as more of a controller.

If you could post more about what your application does, and what kind of errors you are catching, I couldbe of more help to you.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unload a servlet in Tomcat