@Test public void testCountDown() { AtomicBoolean callbackInvoked = new AtomicBoolean(false); CountDownCompleter<String> completer = new CountDownCompleter<>("foo", 2L, v -> callbackInvoked.set(true)); completer.countDown(); assertFalse(callbackInvoked.get()); assertFalse(completer.isComplete()); completer.countDown(); assertTrue(callbackInvoked.get()); assertTrue(completer.isComplete()); }
public void countDown() { if (counter.decrementAndGet() == 0) { onCompleteCallback.accept(object); } }
CountDownCompleter { public void countDown() { if (counter.decrementAndGet() == 0) { onCompleteCallback.accept(object); } } }
CountDownCompleter { public void countDown() { if (counter.decrementAndGet() == 0) { onCompleteCallback.accept(object); } } CountDownCompleter(T object, long count, Consumer<T> onCompleteCallback); }
CountDownCompleter { public void countDown() { if (counter.decrementAndGet() == 0) { onCompleteCallback.accept(object); } } CountDownCompleter(T object, long count, Consumer<T> onCompleteCallback); T object(); void countDown(); boolean isComplete(); }
CountDownCompleter { public void countDown() { if (counter.decrementAndGet() == 0) { onCompleteCallback.accept(object); } } CountDownCompleter(T object, long count, Consumer<T> onCompleteCallback); T object(); void countDown(); boolean isComplete();  }