• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling destroy() inside init()

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried this?
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic