This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes calling destroy() in init() method in servlet 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
Reply locked New topic

calling destroy() in init() method in servlet

priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79
Hi All,

Calling destroy() method inside init() will it destroy the servlet or init() method will continue it process?

Thanks in advance
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60082

It will simply call the method. Why would you even wonder about doing something so nonsensical?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham

Joined: Oct 14, 2005
Posts: 18165

That exact question is already in the Ranch's Servlets FAQ. Have a look there.
I agree. Here's the link:
subject: calling destroy() in init() method in servlet
Similar Threads
calling destroy() from init()
what code will be there in init() of GenericServlet
Calling destroy() inside init()
destroy() method of servlet.
Servlet Destroy() Method