Code example for ReadWriteLock

Methods: readLock

0
   * @return the read lock or null if not required 
   */ 
  protected Lock acquireReadLock()
  { 
    if (null == _readWriteLock) return null;
    Lock readLock = _readWriteLock.readLock();
    readLock.lock();
    return readLock;
  } 
 
  /** 
   * Obtains a write lock if required. If the lock is acquired in a relation with another lock, 
   * it will do so in a way that avoids deadlocks. 
   * @param  otherLock          the other lock; can be null; otherwise, must be locked 
   * @return the write lock or null if not required 
   */ 
  protected Lock acquireWriteLock(Lock otherLock)
  { 
    Lock result = null;
    if (null != _readWriteLock)
Connect your IDE to all the code out there  Get Codota for Java