@Test public void testVoteYesBlocking() throws Exception { final AtomicBoolean voted = new AtomicBoolean(false); future.voteYes(); future.voteYes(); executor.schedule(() -> { voted.set(true); future.voteYes(); }, 1, TimeUnit.SECONDS); assertFutureEquals(result, future); Assert.assertTrue("Future completed before vote", voted.get()); }
void voteYes() { if (castVote()) { synchronized (failures) { resolveResult(); } } }
VotingFuture extends AbstractFuture<T> { void voteYes() { if (castVote()) { synchronized (failures) { resolveResult(); } } } }
VotingFuture extends AbstractFuture<T> { void voteYes() { if (castVote()) { synchronized (failures) { resolveResult(); } } } VotingFuture(final T result, final int requiredVotes); }
VotingFuture extends AbstractFuture<T> { void voteYes() { if (castVote()) { synchronized (failures) { resolveResult(); } } } VotingFuture(final T result, final int requiredVotes);  }
VotingFuture extends AbstractFuture<T> { void voteYes() { if (castVote()) { synchronized (failures) { resolveResult(); } } } VotingFuture(final T result, final int requiredVotes);   }