public byte[] take() throws KeeperException, InterruptedException {
  TimerContext timer=stats.time(dir + "_take");
  updateLock.lockInterruptibly();
  try {
    while (true) {
      byte[] result=removeFirst();
      if (result != null) {
        return result;
      }
      changed.await();
    }
  }
  finally {
    updateLock.unlock();
    timer.stop();
  }
}

public byte [ ] take ( ) throws KeeperException , InterruptedException { TimerContext timer = stats . time ( dir + "_take" ) ; updateLock . lockInterruptibly ( ) ; try { while ( true ) { byte [ ] result = removeFirst ( ) ; if ( result != null ) { return result ; } changed . await ( ) ; } } finally { updateLock . unlock ( ) ; timer . stop ( ) ; } }
removes the head of the queue and returns it , blocks until it succeeds .
