Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

about init() and destroy() in Servlet

 
raj malhotra
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
can anyone please clarify this statement for init(ServletConfig) in Servlet interface
ie 'Called by the servlet container to indicate to a servlet that the servlet is being placed into service.'
I am not clear whether servlet is placed in service and then container call this init method to tell servlet that it is in service and can handle client request...

same for destroy() . when it is called before or after servlet is taken out of service.

Thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we interpret "the servlet is in service" to mean that "HTTP request are being sent to the servlet", then init is called before the first request is sent, and destroy is called after the last request has been completed.
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!