my dog learned polymorphism
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 Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "destroy() method" Watch "destroy() method" New topic

destroy() method

Harikrishna Gorrepati
Ranch Hand

Joined: Sep 23, 2010
Posts: 423

1. Because destroy() is callback method which is called by Container when the server is about to shutdown, Do we need to override it (or) leave it to the container.
2. Even though I write couple of System.out.println() statements in destroy() method and shutdown the server, they are not printed on the console.

Please advice.

OCPJP 6.0-81% | Preparing for OCWCD | |
Javin Paul
Ranch Hand

Joined: Oct 15, 2010
Posts: 295

Hi Hari,

As per my knowledge destroy() method is called before a Servlet gets unloaded from Container. though its upto container implementation on which other cases its provides callback to destroy() method.


SQL Query Interview Question java67 Javarevisited
I agree. Here's the link:
subject: destroy() method
It's not a secret anymore!