public void unlock(final T tx){
  if (DEBUG)   log.debug("enter");
  lock.lock();
  if (DEBUG)   log.debug("have private lock");
  try {
    assertNotDead();
    assertOwnsLock(tx);
    if (queue.remove() != tx) {
      throw new AssertionError();
    }
    if (waitsFor != null) {
      final Iterator<T> itr=queue.iterator();
synchronized (waitsFor) {
        while (itr.hasNext()) {
          final T pendingTx=itr.next();
          try {
            waitsFor.removeEdge(pendingTx,tx);
          }
 catch (          Throwable t) {
            log.warn(t.getMessage(),t);
          }
        }
      }
    }
    if (queue.isEmpty()) {
      if (INFO)       log.info("Nothing pending");
      return;
    }
    if (INFO)     log.info("Signaling blocked requestors");
    available.signalAll();
  }
  finally {
    lock.unlock();
    if (DEBUG)     log.debug("released private lock");
  }
}

public void unlock ( final T tx ) { if ( DEBUG ) log . debug ( "enter" ) ; lock . lock ( ) ; if ( DEBUG ) log . debug ( "have private lock" ) ; try { assertNotDead ( ) ; assertOwnsLock ( tx ) ; if ( queue . remove ( ) != tx ) { throw new AssertionError ( ) ; } if ( waitsFor != null ) { final Iterator < T > itr = queue . iterator ( ) ; synchronized ( waitsFor ) { while ( itr . hasNext ( ) ) { final T pendingTx = itr . next ( ) ; try { waitsFor . removeEdge ( pendingTx , tx ) ; } catch ( Throwable t ) { log . warn ( t . getMessage ( ) , t ) ; } } } } if ( queue . isEmpty ( ) ) { if ( INFO ) log . info ( "Nothing pending" ) ; return ; } if ( INFO ) log . info ( "Signaling blocked requestors" ) ; available . signalAll ( ) ; } finally { lock . unlock ( ) ; if ( DEBUG ) log . debug ( "released private lock" ) ; } }
release the lock held by the tx on the resource .
