public void takeHints(Collection<Hint> c,int maxElements) throws InterruptedException {
  int count=0;
  try {
    while (count == 0) {
      hintLock.lock();
      while (hintQueue.isEmpty()) {
        hintsAvailable.await();
      }
      while (count < maxElements && !hintQueue.isEmpty()) {
        HintKey hintKey=hintQueue.pollFirst();
        if (hintKey != null) {
          List<Versioned<byte[]>> values=hints.remove(hintKey);
          if (values == null) {
            continue;
          }
          c.add(new Hint(hintKey,values));
          count+=1;
        }
      }
    }
  }
  finally {
    hintLock.unlock();
  }
}

public void takeHints ( Collection < Hint > c , int maxElements ) throws InterruptedException { int count = 0 ; try { while ( count == 0 ) { hintLock . lock ( ) ; while ( hintQueue . isEmpty ( ) ) { hintsAvailable . await ( ) ; } while ( count < maxElements && ! hintQueue . isEmpty ( ) ) { HintKey hintKey = hintQueue . pollFirst ( ) ; if ( hintKey != null ) { List < Versioned < byte [ ] > > values = hints . remove ( hintKey ) ; if ( values == null ) { continue ; } c . add ( new Hint ( hintKey , values ) ) ; count += 1 ; } } } } finally { hintLock . unlock ( ) ; } }
drain up to the given number of hints to the provided collection . this method will block until at least one hint is available
