Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unload a servlet in Tomcat

 
kamalesh radhakris
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic