@InterfaceStability.Evolving public abstract class KafkaFuture<T> extends java.lang.Object implements java.util.concurrent.Future<T>
Modifier and Type | Class and Description |
---|---|
static class |
KafkaFuture.BiConsumer<A,B>
A consumer of two different types of object.
|
static class |
KafkaFuture.Function<A,B>
A function which takes objects of type A and returns objects of type B.
|
Constructor and Description |
---|
KafkaFuture() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addWaiter(KafkaFuture.BiConsumer<? super T,? super java.lang.Throwable> action) |
static KafkaFuture<java.lang.Void> |
allOf(KafkaFuture<?>... futures)
Returns a new KafkaFuture that is completed when all the given futures have completed.
|
abstract boolean |
cancel(boolean mayInterruptIfRunning)
If not already completed, completes this future with a CancellationException.
|
protected abstract boolean |
complete(T newValue)
If not already completed, sets the value returned by get() and related methods to the given
value.
|
static <U> KafkaFuture<U> |
completedFuture(U value)
Returns a new KafkaFuture that is already completed with the given value.
|
protected abstract boolean |
completeExceptionally(java.lang.Throwable newException)
If not already completed, causes invocations of get() and related methods to throw the given
exception.
|
abstract T |
get()
Waits if necessary for this future to complete, and then returns its result.
|
abstract T |
get(long timeout,
java.util.concurrent.TimeUnit unit)
Waits if necessary for at most the given time for this future to complete, and then returns
its result, if available.
|
abstract T |
getNow(T valueIfAbsent)
Returns the result value (or throws any encountered exception) if completed, else returns
the given valueIfAbsent.
|
abstract boolean |
isCancelled()
Returns true if this CompletableFuture was cancelled before it completed normally.
|
abstract boolean |
isCompletedExceptionally()
Returns true if this CompletableFuture completed exceptionally, in any way.
|
abstract boolean |
isDone()
Returns true if completed in any fashion: normally, exceptionally, or via cancellation.
|
abstract <R> KafkaFuture<R> |
thenApply(KafkaFuture.Function<T,R> function)
Returns a new KafkaFuture that, when this future completes normally, is executed with this
futures's result as the argument to the supplied function.
|
public static <U> KafkaFuture<U> completedFuture(U value)
public static KafkaFuture<java.lang.Void> allOf(KafkaFuture<?>... futures)
public abstract <R> KafkaFuture<R> thenApply(KafkaFuture.Function<T,R> function)
protected abstract void addWaiter(KafkaFuture.BiConsumer<? super T,? super java.lang.Throwable> action)
protected abstract boolean complete(T newValue)
protected abstract boolean completeExceptionally(java.lang.Throwable newException)
public abstract boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public abstract T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public abstract T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public abstract T getNow(T valueIfAbsent) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public abstract boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public abstract boolean isCompletedExceptionally()
public abstract boolean isDone()
isDone
in interface java.util.concurrent.Future<T>