3 Replies Latest reply on Aug 30, 2007 4:20 AM by Nicklas Karlsson

    General object-locking gizmo

    Nicklas Karlsson Master


      I need an application level class for general locking with an interface something like

      public void lock(Object o, User u);
      public void unlock(Object o, User u); // u for verification
      public boolean isLocked(Object o);
      public List getUserLocks(User u);
      public void releaseAllUserLocks(User u);

      The issue if the all-too-familiar "what happens when the user just hangs around". If i make this an application-scoped component, how should I handle this?

      If I put a destroy-methdod that calls releaseAllUserLocks on a session based component, does it detect the session has ended (probably not) or is it detected only when accessed the next time?

      Do I have to maintain a sessionid->user mapping somewhere in the servlet context and use a session-ended-listener? Even then, can I access the seam component from there?

      Any other options?