Code example for CountDownLatch

Methods: countDown, getCount

0
		return value;
	} 
 
	public synchronized Promise<V> set(V value) {
		this.value = value;
		latch.countDown();
		if (isDone()) { 
			if (block != null) {
				block.apply(value);
			} 
		} 
		return this;
	} 
 
	@Override 
	protected synchronized void linkTo(Block<V> block) {
		checkNotNull(block);
 
		if (isDone()) { 
			block.apply(value);
		} else { 
			this.block = block;
		} 
	} 
 
	private boolean isDone() { 
		return latch.getCount() <= 0;
	} 
}