If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Load Balancing

In my ASP experience I have tried to avoid using variables and objects with
Application of Session scope due to the issues they raise for Load Balancing
a site. Do these same concerns exist for JSP Application and Session scoped
objects?

Re: Load Balancing

In article <39993fd9$1@news.devx.com>,
Scott A. Flaherty <scott@hyperactiveinc.com> wrote:
>In my ASP experience I have tried to avoid using variables and objects with
>Application of Session scope due to the issues they raise for Load Balancing
>a site. Do these same concerns exist for JSP Application and Session scoped
>objects?

The JSP specification is the ultimate authority on questions like
this, it can be downloaded from http://java.sun.com/products/jsp/download.html.
Unfortunately it's a little murky on this point. Section 2.7.2 on
synchronization issues warns that in implementations that do load
balancing, mutable resources such as session and application scope
objects may be changed by two or more threads simultaneously, and so
must be protected.

I would assume this means that if something is in the application or
session scope, that each server is required to access the same
instance of the object. So, if I understand this correctly, you can
go ahead and use these scopes without worrying that different people
will see different versions of the same object.

At least, in theory...

Honestly, I'm not sure how well the various JSP implementations
support this. Knowing how stringent Sun is about licensing, I imagine
that most products that claim JSP compliance will get it right. Just
to be sure, you should probably check with your vendor (or potential
vendor) to see how they deal with this issue. If they don't promise
that everyone sees the same application-scoped value you can hit them
over the head with the specification at them and go find a different
vendor.