aspose file tools*
The moose likes Servlets and the fly likes destroy method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "destroy method" Watch "destroy method" New topic
Author

destroy method

Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Hi all,
Instead of destroy being called by the container, can we explicity call the destroy method IN the service method.
tia
MB


Malhar Barai
SOA & Java Book
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Well, strictly, it's just a method like any other, so yes, you can.
However, the container will call destroy when the servlet or JSP is unloaded, whether you have called it already or not, so you have to be careful that you make it safe to call twice if you plan to call it yourself.
What worries me though, is why you think it might be useful. Can you explain a little more what you want to do this for? It may be that we can suggest a better alternative.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Hi,
Actually I was thrown upon this question & was wondering what could be done. What I thought was that the destroy method would be over-ridden.
AW...thnx
MB
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: destroy method
 
Similar Threads
ServletException from destroy( )
when is destroy called
how to test destroy() in a servlet
when destroy method will call
WA #1.....word association