jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r191150 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
Date Fri, 17 Jun 2005 12:54:03 GMT
Author: dpfister
Date: Fri Jun 17 05:54:02 2005
New Revision: 191150

URL: http://svn.apache.org/viewcvs?rev=191150&view=rev
Log:
JCR-137 Open-scoped locks may be lost on restart and might not be transferrable

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java?rev=191150&r1=191149&r2=191150&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java Fri
Jun 17 05:54:02 2005
@@ -174,12 +174,21 @@
     /**
      * {@inheritDoc}
      * <p/>
-     * When the owning session is logging out, we should unlock the node on
-     * behalf of the user currently holding it.
+     * When the owning session is logging out, we have to perform some
+     * operations depending on the lock type.
+     * (1) If the lock was session-scoped, we unlock the node.
+     * (2) If the lock was open-scoped, we remove the lock token
+     *     from the session.
      */
     public void loggingOut(SessionImpl session) {
         if (live) {
-            lockMgr.unlock(this);
+            if (sessionScoped) {
+                lockMgr.unlock(this);
+            } else {
+                if (session.equals(lockHolder)) {
+                    lockHolder = null;
+                }
+            }
         }
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=191150&r1=191149&r2=191150&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
Fri Jun 17 05:54:02 2005
@@ -151,7 +151,9 @@
      */
     private void reapplyLock(LockToken lockToken) {
         try {
-            NodeImpl node = (NodeImpl) session.getNodeByUUID(lockToken.uuid);
+            NodeId id = new NodeId(lockToken.uuid);
+
+            NodeImpl node = (NodeImpl) session.getItemManager().getItem(id);
             Path path = node.getPrimaryPath();
 
             LockInfo info = new LockInfo(this, lockToken, false,
@@ -241,9 +243,7 @@
         SessionImpl session = (SessionImpl) node.getSession();
         info.setLockHolder(session);
         info.setLive(true);
-        if (info.sessionScoped) {
-            session.addListener(info);
-        }
+        session.addListener(info);
         session.addLockToken(info.lockToken.toString(), false);
         lockMap.put(path, info);
         return new LockImpl(info, node);



Mime
View raw message