@Test(expected = IllegalStateException.class) public void invokeCompleteAfterAlreadyComplete() { RequestFuture<Void> future = new RequestFuture<>(); future.complete(null); future.complete(null); }
public void complete(T value) { try { if (value instanceof RuntimeException) throw new IllegalArgumentException("The argument to complete can not be an instance of RuntimeException"); if (!result.compareAndSet(INCOMPLETE_SENTINEL, value)) throw new IllegalStateException("Invalid attempt to complete a request future which is already complete"); fireSuccess(); } finally { completedLatch.countDown(); } }
RequestFuture implements ConsumerNetworkClient.PollCondition { public void complete(T value) { try { if (value instanceof RuntimeException) throw new IllegalArgumentException("The argument to complete can not be an instance of RuntimeException"); if (!result.compareAndSet(INCOMPLETE_SENTINEL, value)) throw new IllegalStateException("Invalid attempt to complete a request future which is already complete"); fireSuccess(); } finally { completedLatch.countDown(); } } }
RequestFuture implements ConsumerNetworkClient.PollCondition { public void complete(T value) { try { if (value instanceof RuntimeException) throw new IllegalArgumentException("The argument to complete can not be an instance of RuntimeException"); if (!result.compareAndSet(INCOMPLETE_SENTINEL, value)) throw new IllegalStateException("Invalid attempt to complete a request future which is already complete"); fireSuccess(); } finally { completedLatch.countDown(); } }  }
RequestFuture implements ConsumerNetworkClient.PollCondition { public void complete(T value) { try { if (value instanceof RuntimeException) throw new IllegalArgumentException("The argument to complete can not be an instance of RuntimeException"); if (!result.compareAndSet(INCOMPLETE_SENTINEL, value)) throw new IllegalStateException("Invalid attempt to complete a request future which is already complete"); fireSuccess(); } finally { completedLatch.countDown(); } }  boolean isDone(); boolean awaitDone(long timeout, TimeUnit unit); @SuppressWarnings("unchecked") T value(); boolean succeeded(); boolean failed(); boolean isRetriable(); RuntimeException exception(); void complete(T value); void raise(RuntimeException e); void raise(Errors error); void addListener(RequestFutureListener<T> listener); RequestFuture<S> compose(final RequestFutureAdapter<T, S> adapter); void chain(final RequestFuture<T> future); static RequestFuture<T> failure(RuntimeException e); static RequestFuture<Void> voidSuccess(); static RequestFuture<T> coordinatorNotAvailable(); static RequestFuture<T> leaderNotAvailable(); static RequestFuture<T> noBrokersAvailable(); static RequestFuture<T> staleMetadata(); @Override boolean shouldBlock(); }
RequestFuture implements ConsumerNetworkClient.PollCondition { public void complete(T value) { try { if (value instanceof RuntimeException) throw new IllegalArgumentException("The argument to complete can not be an instance of RuntimeException"); if (!result.compareAndSet(INCOMPLETE_SENTINEL, value)) throw new IllegalStateException("Invalid attempt to complete a request future which is already complete"); fireSuccess(); } finally { completedLatch.countDown(); } }  boolean isDone(); boolean awaitDone(long timeout, TimeUnit unit); @SuppressWarnings("unchecked") T value(); boolean succeeded(); boolean failed(); boolean isRetriable(); RuntimeException exception(); void complete(T value); void raise(RuntimeException e); void raise(Errors error); void addListener(RequestFutureListener<T> listener); RequestFuture<S> compose(final RequestFutureAdapter<T, S> adapter); void chain(final RequestFuture<T> future); static RequestFuture<T> failure(RuntimeException e); static RequestFuture<Void> voidSuccess(); static RequestFuture<T> coordinatorNotAvailable(); static RequestFuture<T> leaderNotAvailable(); static RequestFuture<T> noBrokersAvailable(); static RequestFuture<T> staleMetadata(); @Override boolean shouldBlock();  }