Пример #1
0
 /**
  * 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;
   }
 }
 /** @return {@code True} if lock is local. */
 public boolean local() {
   return LOCAL.get(flags());
 }