public void sleep(long milliSeconds){
  lock.lock();
  try {
    if (t != 0) {
      t=System.currentTimeMillis() + milliSeconds;
      while (true) {
        final long dt=t - System.currentTimeMillis();
        if (dt <= 0) {
          break;
        }
 else {
          wakeup.await(dt,TimeUnit.MILLISECONDS);
        }
      }
    }
    t=System.currentTimeMillis();
  }
 catch (  InterruptedException e) {
    logger.error(e.getMessage(),e);
  }
 finally {
    lock.unlock();
  }
}

public void sleep ( long milliSeconds ) { lock . lock ( ) ; try { if ( t != 0 ) { t = System . currentTimeMillis ( ) + milliSeconds ; while ( true ) { final long dt = t - System . currentTimeMillis ( ) ; if ( dt <= 0 ) { break ; } else { wakeup . await ( dt , TimeUnit . MILLISECONDS ) ; } } } t = System . currentTimeMillis ( ) ; } catch ( InterruptedException e ) { logger . error ( e . getMessage ( ) , e ) ; } finally { lock . unlock ( ) ; } }
sleep for a specific amount of time , or until the wakeup method is called , whichever comes first
