Examples of ReentrantLock


Examples of java.util.concurrent.locks.ReentrantLock

   */
  public boolean tryEnterIf(Guard guard) {
    if (guard.monitor != this) {
      throw new IllegalMonitorStateException();
    }
    final ReentrantLock lock = this.lock;
    if (!lock.tryLock()) {
      return false;
    }
    boolean satisfied;
    try {
      satisfied = guard.isSatisfied();
    } catch (Throwable throwable) {
      lock.unlock();
      throw Throwables.propagate(throwable);
    }
    if (satisfied) {
      return true;
    } else {
      lock.unlock();
      return false;
    }
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock

  /**
   * Leaves this monitor. May be called only by a thread currently occupying this monitor.
   */
  @GuardedBy("lock")
  public void leave() {
    final ReentrantLock lock = this.lock;
    if (!lock.isHeldByCurrentThread()) {
      throw new IllegalMonitorStateException();
    }
    try {
      signalConditionsOfSatisfiedGuards(null);
    } finally {
      lock.unlock();
    }
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock

   *
   * <p>This never needs to be called by a thread occupying the monitor, because all other monitor
   * methods ensure that all guards are evaluated whenever necessary.
   */
  public void reevaluateGuards() {
    final ReentrantLock lock = this.lock;
    lock.lock();
    try {
      signalConditionsOfSatisfiedGuards(null);
    } finally {
      lock.unlock();
    }
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock

      // I'm recreating the lock object when we return to the pool
      // because it looks too nasty to expect the connection handle
      // to unlock properly in certain race conditions
      // where the dissociation of the managed connection is "random".
      lock = new ReentrantLock(true);
   }
View Full Code Here

Examples of kilim.ReentrantLock

  /**
   * @return
   */
  protected Lock driver_pdl_create() {
    if (pdl == null) {
      pdl = new ReentrantLock();
    }
    return pdl;
  }
View Full Code Here

Examples of org.apache.openjpa.lib.util.concurrent.ReentrantLock

        _access = access;
        _dirty = new BitSet(_loaded.length());
        _oid = sm.fetchObjectId();
        _version = sm.getVersion();
        if (multithreaded)
            _lock = new ReentrantLock();
        else
            _lock = null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.