@Test public void exceptionsArePropagated() { RuntimeException expected = new RuntimeException("foo"); when(delegate.get()).thenThrow(expected); assertThatThrownBy(() -> supplier.get()).hasMessage(expected.getMessage()); }
@Override public T get() { Round present = round; if (present.isFirstToArrive()) { present.execute(); return present.getResult(); } Round next = present.awaitDone(); if (next.isFirstToArrive()) { next.execute(); } return next.getResult(); }
CoalescingSupplier implements Supplier<T> { @Override public T get() { Round present = round; if (present.isFirstToArrive()) { present.execute(); return present.getResult(); } Round next = present.awaitDone(); if (next.isFirstToArrive()) { next.execute(); } return next.getResult(); } }
CoalescingSupplier implements Supplier<T> { @Override public T get() { Round present = round; if (present.isFirstToArrive()) { present.execute(); return present.getResult(); } Round next = present.awaitDone(); if (next.isFirstToArrive()) { next.execute(); } return next.getResult(); } CoalescingSupplier(Supplier<T> delegate); }
CoalescingSupplier implements Supplier<T> { @Override public T get() { Round present = round; if (present.isFirstToArrive()) { present.execute(); return present.getResult(); } Round next = present.awaitDone(); if (next.isFirstToArrive()) { next.execute(); } return next.getResult(); } CoalescingSupplier(Supplier<T> delegate); @Override T get(); ListenableFuture<T> getAsync(); }
CoalescingSupplier implements Supplier<T> { @Override public T get() { Round present = round; if (present.isFirstToArrive()) { present.execute(); return present.getResult(); } Round next = present.awaitDone(); if (next.isFirstToArrive()) { next.execute(); } return next.getResult(); } CoalescingSupplier(Supplier<T> delegate); @Override T get(); ListenableFuture<T> getAsync();  }