This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Calling destroy() inside  init() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling destroy() inside  init() " Watch "Calling destroy() inside  init() " New topic
Author

Calling destroy() inside init()

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
What happens if you call destroy() from init() in java servlet. means destroy() gets executed . will initialization process continues or gets completed.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What happened when you tried this?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
some problem in my weblogic server . its not working fine. so i am asking whether the servlet is destroyed or not after calling destroy inside init()
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Calling destroy doesn't do anything (other than execute any code that YOU put in your destroy method).
The init and destroy methods are callback methods that get called by the container when the servlet is either put into or taken out of service, respectively.

A better name for them might have been onInit or onDestroy.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling destroy() inside init()
 
Similar Threads
what are container callback methods??
Servlet's init() and destroy() method and constructors
doPost and service
WA #1.....word association
Call destroy() inside init()