:-:= Koshy Kerteya :-=:- wrote:
>
> HelloServlet() {
>   System.out.println("invoked!!");
> }
>
> I thought that I would get "invoked"!!! for each thread
> (upon each request) Apparently no, ....so that means only
> 1 instance is ? and threads came from this instance...?
>

 Basically yes.

 The spec has a reasonable discussion of the servlet
lifecycle in section 2.3. You can get a copy from:

 <URL:http://java.sun.com/products/servlet/download.html>

 It turns out that the lifecycle is a little more
complicated than most people expect. Just remember
that the servlet engine can take servlets out of
service any time it wants (even if the container is
not shutting down) and then bring them back to life
later on. So if you allocate resources in init(), you
always need to deallocate them in destroy().

 A good strategy is to read section 2.3, spend some
time thinking about it, and then email servlet-interest
again if you have any further questions.


--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to