FWIW, this is done.  This is done -- to obtain a mutex for the
current session, do:

 Object mutex = ServletUtils.getSessionMutex(httpSession);

If the HttpSessionMutexListener is wired into web.xml, a simple Object
will be returned as the mutex; otherwise, the HttpSession will be
returned.  Note, it's up to the caller to satisfy the correct locking
semantics for their servlet container.  In some circumstances, the
HttpSession *can not* be used to lock the session.

 Carlin, I don't know the scoping code that well -- could you take a
look and make sure that the "right" thing is happening with the mutex
and a scoped session?  It might be the case that the Listener and
utility method need to tunnel into the "real" HttpSession.

 Let me know if you've got questions.

Eddie


On 5/26/06, Eddie O'Neil <[EMAIL PROTECTED]> wrote:
All--

  I'm about to make a slight design change to the way NetUI does
user-wide locking.  This is currently done on the session, which works
often but not all the time depending on the implementation of the
HttpSession object.  In order to ensure that this works correctly on
all containers and session implementations, I'm going to add an
optional HttpSessionListener that will create a session-wide mutex
object that can be used to serialize a change in the session.

  This will be used in two places:
- where the DeferredSessionStorageHandler persists changes to the HttpSession
- where the NameService adds itself to an HttpSession

I don't expect any problems with this -- it's a reasonably simple
change.  If the HttpSessionListener isn't wired up, the implementation
will fall back to using the HttpSession.

This will affect the following code:
- add an o.a.b.n.p.HttpSessionMutexListener class that adds / removes
a private inner class Mutex object
- add an Object getSessionMutex(HttpSession session) method to
o.a.b.n.u.i.ServletUtils
- add a Stirng contasnt to ServletUtils that defines the key used to
store the mutex in the session.

This follows a pattern similar to that used in Spring to provide a
user-scoped lock that isn't the HttpSession object.

  Comments welcome.

Eddie

Reply via email to