private static void releaseLatch(final CountDownLatch latch){
  if (latch == null) {
    return;
  }
  while (latch.getCount() > 0) {
    latch.countDown();
  }
}

private static void releaseLatch ( final CountDownLatch latch ) { if ( latch == null ) { return ; } while ( latch . getCount ( ) > 0 ) { latch . countDown ( ) ; } }
utility method to fully release any countdownlatch .
