Code example for CountDownLatch

Methods: awaitgetCount

0
     *  
     * @param failureMessage 
     * @throws InterruptedException 
     */ 
    public void waitForAction( String failureMessage ) throws InterruptedException{
        countDownLatch.await( timeout, TimeUnit.MILLISECONDS );
        if( countDownLatch.getCount() > 0 ) fail( failureMessage );
    } 
 
    /** 
     * The other Thread invokes this. 
     */ 
    public void action(){ 
        countDownLatch.countDown();
    } 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE