/** * Create a new lock * * @param lockInfo lock info * @throws IllegalArgumentException if either scope or type is invalid. */ public SerializableActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new lock * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid. */ public DefaultActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new lock * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid. */ public DefaultActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new lock * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid. */ public DefaultActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new transaction lock.<br> * If the lockInfo element is <code>null</code> the timeout defaults to * half and hour. The default scope is 'local'. * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid or if * a depth other than infinity is requested. */ public TxActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!TRANSACTION.equals(lockInfo.getType())) { throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object."); } if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element."); } if (!lockInfo.isDeep()) { throw new IllegalArgumentException("Only transaction locks can only be deep."); } setOwner(lockInfo.getOwner()); setTimeout(lockInfo.getTimeout()); scope = lockInfo.getScope(); } else { setTimeout(DEFAULT_TIMEOUT); // local scope by default scope = LOCAL; } }
/** * Create a new transaction lock.<br> * If the lockInfo element is <code>null</code> the timeout defaults to * half and hour. The default scope is 'local'. * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid or if * a depth other than infinity is requested. */ public TxActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!TRANSACTION.equals(lockInfo.getType())) { throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object."); } if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element."); } if (!lockInfo.isDeep()) { throw new IllegalArgumentException("Only transaction locks can only be deep."); } setOwner(lockInfo.getOwner()); setTimeout(lockInfo.getTimeout()); scope = lockInfo.getScope(); } else { setTimeout(DEFAULT_TIMEOUT); // local scope by default scope = LOCAL; } }
Lock jcrLock = lockMgr.lock(node.getPath(), lockInfo.isDeep(), false, timeout, lockInfo.getOwner()); if (jcrLock != null) { lock = new JcrActiveLock(jcrLock);
/** * Create a new transaction lock.<br> * If the lockInfo element is <code>null</code> the timeout defaults to * half and hour. The default scope is 'local'. * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid or if * a depth other than infinity is requested. */ public TxActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!TRANSACTION.equals(lockInfo.getType())) { throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object."); } if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element."); } if (!lockInfo.isDeep()) { throw new IllegalArgumentException("Only transaction locks can only be deep."); } setOwner(lockInfo.getOwner()); setTimeout(lockInfo.getTimeout()); scope = lockInfo.getScope(); } else { setTimeout(DEFAULT_TIMEOUT); // local scope by default scope = LOCAL; } }
sessionScoped, timeout, reqLockInfo.getOwner()); ActiveLock lock = new JcrActiveLock(jcrLock);