File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling destroy() inside init()
 
Similar Threads
Call destroy() inside init()
Servlet's init() and destroy() method and constructors
WA #1.....word association
what are container callback methods??
doPost and service