try {
SessionImpl session = (SessionImpl) node.getSession();
// check whether node is locked by this session
PathMap.Element element = lockMap.map(getPath(session, node.getId()), true);
if (element == null) {
throw new LockException("Node not locked: " + node);
}
AbstractLockInfo info = (AbstractLockInfo) element.get();
if (info == null) {
throw new LockException("Node not locked: " + node);
}
if (session != info.getLockHolder()) {
throw new LockException("Node not locked by session: " + node);
}
getSessionLockManager(session).lockTokenRemoved(info.getLockToken(session));
element.set(null);