Code example for CountDownLatch

Methods: countDown, getCount

0
    } 
     
    public void onChipsterMessage(ChipsterMessage message) {
    	 
    	// do nothing if already got one reply 
    	if (latch.getCount() == 0) {
    		return; 
    	} 
    	 
    	SourceMessage sourceMessage = (SourceMessage) message;
        this.source = sourceMessage.getSource();
        latch.countDown();
    } 
}