wood burning stoves 2.0
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling destroy() inside  init() " Watch "Calling destroy() inside  init() " New topic

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

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

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()
It's not a secret anymore!