Oh, ok. I guess I wasn't in fact saying the same thing... I didn't realise that
the container could go through the init(), service(), destroy() cycle many
times. Thanks for the clarification: it's good to know this bit about having to
release in destroy() all resources acquire in init(). Thanks again!
Geeta

"Christopher K. St. John" wrote:

> Geeta Ramani wrote:
> >
> > Well, ok, I guess you mean *explicitly* calling the init() in the code as
> > opposed to automatically/implicitly calling it when the servlet is
> > initialized..
> >
>
>  I'm not sure if we're saying the same thing or not,
> but to clarify what I was trying to say:
>
>  A servlet container can put a servlet through the
> init(), service(), destroy() lifecycle many times
> during the lifetime of the container[1]
>
>  In fact, if the container is being perverse (or
> the load on the container is very high) it's
> possible that for every single request to the
> servlet, the servlet is init()'ed and destroy()'ed.
>
>  Although that's pretty unlikely, you have to
> program as if it could happen at least once, which
> means that any resource you acquire in init(), you
> have to release in destroy().
>
> > the best thing would be to create the pool in the
> > init(), and then create and release connection within
> > the doGet()/doPost.
> >
>
>  And release the pool in destroy() :-)
>
> [1] Spec 2.3PFD Section 2.3.4 "End of Service", but
> I believe 2.2 says the same thing.
>  <URL:http://java.sun.com/products/servlet/download.html>
>  It might be a fun mini-project to modify one of
> the open source containers to have a "perverse" mode
> that actually does all the stuff the spec says is
> legal...
>
> --
> 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

___________________________________________________________________________
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