@Override public String[] getLockTokens() { Set<String> tokens = new HashSet<String>(); for (String token : lockTokens) { ModeShapeLock lock = lockManager.findLockByToken(token); if (lock != null && !lock.isSessionScoped()) { tokens.add(token); } } return tokens.toArray(new String[tokens.size()]); }
@Override public String[] getLockTokens() { Set<String> tokens = new HashSet<String>(); for (String token : lockTokens) { ModeShapeLock lock = lockManager.findLockByToken(token); if (lock != null && !lock.isSessionScoped()) { tokens.add(token); } } return tokens.toArray(new String[tokens.size()]); }
/** * Unlocks all locks corresponding to the tokens held by the supplied session. * * @throws RepositoryException if the session is not live */ final void cleanLocks() throws RepositoryException { // clean the session-scoped locks: unlock all the nodes and remove the lock tokens from the system area Set<String> cleanedTokens = lockManager.cleanLocks(session); if (lockTokens.isEmpty()) { return; } // clean all open-scoped locks created via this session for (String lockToken : lockTokens) { if (!cleanedTokens.contains(lockToken)) { ModeShapeLock lock = lockManager.findLockByToken(lockToken); if (lock == null) { // there is no existing lock for this token (it must've been removed from somewhere else) continue; } // this is an open-scoped lock created via this session for which we'll have to update the 'held' flag if (!lockManager.setHeldBySession(session, lockToken, false)) { // Generally not expected, because if the lock exists we can always change the lock-held value to false // even when it is already false ... throw new LockException(JcrI18n.invalidLockToken.text(lockToken)); } } } // always clean our internal map of tokens lockTokens.clear(); }
/** * Unlocks all locks corresponding to the tokens held by the supplied session. * * @throws RepositoryException if the session is not live */ final void cleanLocks() throws RepositoryException { // clean the session-scoped locks: unlock all the nodes and remove the lock tokens from the system area Set<String> cleanedTokens = lockManager.cleanLocks(session); if (lockTokens.isEmpty()) { return; } // clean all open-scoped locks created via this session for (String lockToken : lockTokens) { if (!cleanedTokens.contains(lockToken)) { ModeShapeLock lock = lockManager.findLockByToken(lockToken); if (lock == null) { // there is no existing lock for this token (it must've been removed from somewhere else) continue; } // this is an open-scoped lock created via this session for which we'll have to update the 'held' flag if (!lockManager.setHeldBySession(session, lockToken, false)) { // Generally not expected, because if the lock exists we can always change the lock-held value to false // even when it is already false ... throw new LockException(JcrI18n.invalidLockToken.text(lockToken)); } } } // always clean our internal map of tokens lockTokens.clear(); }