Code example for CountDownLatch

Methods: countDown

0
                    try { 
                        c.call();
                    } catch( Exception e ) {
                        exceptions[0] = e;
                    } finally { 
                        latch.countDown();
                    } 
                } 
            }); 
 
            // Wait for onSuccess to finish 
            latch.await();
 
            if( exceptions[0] != null )
                throw exceptions[0];
 
        } 
 
    } 
 
}