private boolean await0(long timeoutMillis,boolean interruptable) throws InterruptedException {
  long endTime=System.currentTimeMillis() + timeoutMillis;
  if (endTime < 0) {
    endTime=Long.MAX_VALUE;
  }
synchronized (lock) {
    if (ready) {
      return ready;
    }
 else     if (timeoutMillis <= 0) {
      return ready;
    }
    waiters++;
    try {
      for (; ; ) {
        try {
          long timeOut=Math.min(timeoutMillis,DEAD_LOCK_CHECK_INTERVAL);
          lock.wait(timeOut);
        }
 catch (        InterruptedException e) {
          if (interruptable) {
            throw e;
          }
        }
        if (ready) {
          return true;
        }
        if (endTime < System.currentTimeMillis()) {
          return ready;
        }
      }
    }
  finally {
      waiters--;
      if (!ready) {
        checkDeadLock();
      }
    }
  }
}

private boolean await0 ( long timeoutMillis , boolean interruptable ) throws InterruptedException { long endTime = System . currentTimeMillis ( ) + timeoutMillis ; if ( endTime < 0 ) { endTime = Long . MAX_VALUE ; } synchronized ( lock ) { if ( ready ) { return ready ; } else if ( timeoutMillis <= 0 ) { return ready ; } waiters ++ ; try { for ( ; ; ) { try { long timeOut = Math . min ( timeoutMillis , DEAD_LOCK_CHECK_INTERVAL ) ; lock . wait ( timeOut ) ; } catch ( InterruptedException e ) { if ( interruptable ) { throw e ; } } if ( ready ) { return true ; } if ( endTime < System . currentTimeMillis ( ) ) { return ready ; } } } finally { waiters -- ; if ( ! ready ) { checkDeadLock ( ) ; } } } }
wait for the future to be ready . if the requested delay is 0 or negative , this method immediately returns the value of the ' ready ' flag . every 5 second , the wait will be suspended to be able to check if there is a deadlock or not .
