### Eclipse Workspace Patch 1.0 #P jackrabbit-core Index: src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (revision 1492642) +++ src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (working copy) @@ -654,12 +654,17 @@ public void checkLock(Path path, Session session) throws LockException, RepositoryException { - PathMap.Element element = lockMap.map(path, false); - LockInfo info = element.get(); - if (info != null) { - if (element.hasPath(path) || info.isDeep()) { - checkLock(info, session); + acquire(); + try { + PathMap.Element element = lockMap.map(path, false); + LockInfo info = element.get(); + if (info != null) { + if (element.hasPath(path) || info.isDeep()) { + checkLock(info, session); + } } + } finally { + release(); } } @@ -688,18 +693,23 @@ */ public void checkUnlock(Session session, NodeImpl node) throws LockException, RepositoryException { - - // check whether node is locked by this session - PathMap.Element element = - lockMap.map(getPath((SessionImpl) session, node.getId()), true); - if (element == null) { - throw new LockException("Node not locked: " + node); + acquire(); + + try { + // check whether node is locked by this session + PathMap.Element element = + lockMap.map(getPath((SessionImpl) session, node.getId()), true); + if (element == null) { + throw new LockException("Node not locked: " + node); + } + LockInfo info = element.get(); + if (info == null) { + throw new LockException("Node not locked: " + node); + } + checkUnlock(info, session); + } finally { + release(); } - LockInfo info = element.get(); - if (info == null) { - throw new LockException("Node not locked: " + node); - } - checkUnlock(info, session); } /** @@ -728,6 +738,8 @@ */ public void addLockToken(SessionImpl session, String lt) throws LockException, RepositoryException { try { + acquire(); + NodeId id = LockInfo.parseLockToken(lt); NodeImpl node = (NodeImpl) sysSession.getItemManager().getItem(id); @@ -754,6 +766,8 @@ String msg = "Bad lock token: " + e.getMessage(); log.warn(msg); throw new LockException(msg); + } finally { + release(); } } @@ -764,6 +778,8 @@ throws LockException, RepositoryException { try { + acquire(); + NodeId id = LockInfo.parseLockToken(lt); NodeImpl node = (NodeImpl) sysSession.getItemManager().getItem(id); @@ -787,6 +803,8 @@ String msg = "Bad lock token: " + e.getMessage(); log.warn(msg); throw new LockException(msg); + } finally { + release(); } }