private static boolean checkConditionMetForAll(CountDownLatch latch, int expected, AtomicInteger actual, long amount, TimeUnit timeUnit) {
    try {
      if (latch.await(amount, timeUnit)) {
        return actual.intValue() == expected;
      }
      return false;
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      return false;
    }
  }
private static boolean checkConditionMetForAll ( CountDownLatch latch , int expected , AtomicInteger actual , long amount , TimeUnit timeUnit ) { try { if ( latch . await ( amount , timeUnit ) ) { return actual . intValue ( ) == expected ; } return false ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return false ; } }
Waits until the latch reaches to zero and then checks if the expected result
@param latch       The latch.
@param expected    The expected number.
@param actual      The actual number.
@param amount      The amount of time to wait.
@param timeUnit    The timeUnit.
@return