On Wed, 12 Apr 2000, Pascal Deschenes wrote:
> No. As only one instance of your servlet is loaded in memory, only
> one instance of all your class scope variables will be created. In
> fact, the init() method is only called once. The servlet container
> fork thread to service() as requests are coming in.
All true, but remember that under certain circumstances, the servlet
engine/container may create multiple instances of a servlet --
e.g. when it implements SingleThreadModel (that may in fact be the
only circumstance, I think the latest servlet spec may dictate that
normally only one instance be created).
> > -----Original Message-----
> > From: A mailing list for discussion about Sun Microsystem's Java Servlet
> > API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of James
> > Skehan
> > Sent: April 12, 2000 10:51 AM
> > To: [EMAIL PROTECTED]
> > Subject: instance variables
> >
> >
> > Hi,
> >
> > A quick question...if I create an instance variable in a servlet, i.e a
> > boolean variable outside of the service() and init() methods, as more
> > requests for this particular servlet are requested, are more instances of
> > this variable created?
> >
> > James
> >
>
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
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