pradeep wrote:
> Hi All
>
> What I learnt from basics of Servlets(non Single thread model) is only one
> instance per Servlet name will be created and all the requests will be
> answered by spawned threads.
>
> But still a doubt, are there any chances in which init() and destroy() will
> get called multiple times?
>
The answer to this question is in the same place as the answer to your previous
questions -- in the servlet API specification document. I would suggest you
refer to the spec for the version supported by your servlet engine, as well as
asking questions when the specs are not clear enough. The specs can be
downloaded from the JavaSoft web site
http://java.sun.com/products/servlet
In the particular case of init() and destroy(), you can count on the following
behavior in a conforming servlet engine:
* init() will be called, and returned from, before
any call to service() on any thread().
* destroy() will be called when there are no active
service() calls on any thread.
In principle, the servlet engine has the right to call your destroy() method at
any time -- for example, if it is memory constrained and wants to release
servlet instances that have not been used for a while. If this happens, the
next call to service() will require a new init() call, which will occur on a
new instance of the servlet.
In practice, many servlet engines will only call destroy() when you initiate a
graceful shutdown. But you cannot count on this, so check with your particular
vendor on their behavior.
Craig McClanahan
___________________________________________________________________________
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