"Craig R. McClanahan" wrote:
> For example, consider a simple hit counting servlet.  The natural place to
> store the counter would be an instance variable in the servlet class (suitably
> initialized in the init() method and saved to disk in the destroy() method).
> But, if the servlet engine was allowed to create more than one instance, this
> counter would not be accurate!  As of 2.2, servlet authors can count on what
> has been standard practice all along -- only one instance of a non-STM servlet
> will be created in a container.
>

What would happen to your hit counting servlet in a load balanced
environment?  Doesn't each app server have its own container with its
own instance of the class?

I've seen you argue convincingly that using the servlet context is a
better way of storing application state than singletons.  Wouldn't the
same apply to instance variables?

Assuming what that each app server does have its own instance, isn't
this part of the spec setting false expectations for developers?

___________________________________________________________________________
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