V - public abstract class AbstractInvocationFuture<V> extends InternalCompletableFuture<V>
CompletableFuture.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractInvocationFuture.AbstractBiNode<T,U,R> |
protected static class |
AbstractInvocationFuture.AbstractEitherNode<T,R> |
protected static class |
AbstractInvocationFuture.ApplyNode<V,R> |
protected static class |
AbstractInvocationFuture.ComposeNode<T,U> |
protected static class |
AbstractInvocationFuture.ExceptionallyNode<R> |
static class |
AbstractInvocationFuture.ExceptionalResult |
protected static class |
AbstractInvocationFuture.RunNode |
CompletableFuture.AsynchronousCompletionTask| Modifier and Type | Field and Description |
|---|---|
protected ILogger |
logger |
protected Object |
state
This field contains the state of the future.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractInvocationFuture(ILogger logger) |
completedExceptionally, completedExceptionally, completingCallback, newCompletedFuture, newCompletedFuture, newCompletedFuture, newCompletedFuture, newDelegatingFuture, withExecutorallOf, anyOf, completedFuture, runAsync, runAsync, supplyAsync, supplyAsyncprotected final ILogger logger
protected volatile Object state
UNRESOLVED: no response is available.WaitNode or Waiter instance: in case of multiple
callback registrations or future.gets.The reason why a single future.get or registered ExecutionCallback doesn't create a WaitNode is that we don't want to cause additional litter since most of our API calls are a get or a single ExecutionCallback.
The state field is replaced using a cas, so registration or setting a response is an atomic operation and therefore not prone to data-races. There is no need to use synchronized blocks.
protected abstract String invocationToString()
protected abstract V resolveAndThrowIfException(Object state) throws ExecutionException, InterruptedException
protected abstract TimeoutException newTimeoutException(long timeout, TimeUnit unit)
public <U> InternalCompletableFuture<U> thenApply(@Nonnull Function<? super V,? extends U> fn)
thenApply in interface CompletionStage<V>thenApply in class CompletableFuture<V>public <U> InternalCompletableFuture<U> thenApplyAsync(@Nonnull Function<? super V,? extends U> fn)
thenApplyAsync in interface CompletionStage<V>thenApplyAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> thenApplyAsync(@Nonnull Function<? super V,? extends U> fn, Executor executor)
thenApplyAsync in interface CompletionStage<V>thenApplyAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> thenAccept(@Nonnull Consumer<? super V> action)
thenAccept in interface CompletionStage<V>thenAccept in class CompletableFuture<V>public InternalCompletableFuture<Void> thenAcceptAsync(@Nonnull Consumer<? super V> action)
thenAcceptAsync in interface CompletionStage<V>thenAcceptAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> thenAcceptAsync(@Nonnull Consumer<? super V> action, @Nonnull Executor executor)
thenAcceptAsync in interface CompletionStage<V>thenAcceptAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> thenRun(@Nonnull Runnable action)
thenRun in interface CompletionStage<V>thenRun in class CompletableFuture<V>public InternalCompletableFuture<Void> thenRunAsync(@Nonnull Runnable action)
thenRunAsync in interface CompletionStage<V>thenRunAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> thenRunAsync(@Nonnull Runnable action, @Nonnull Executor executor)
thenRunAsync in interface CompletionStage<V>thenRunAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> handle(@Nonnull BiFunction<? super V,Throwable,? extends U> fn)
handle in interface CompletionStage<V>handle in class CompletableFuture<V>public <U> InternalCompletableFuture<U> handleAsync(@Nonnull BiFunction<? super V,Throwable,? extends U> fn)
handleAsync in interface CompletionStage<V>handleAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> handleAsync(@Nonnull BiFunction<? super V,Throwable,? extends U> fn, @Nonnull Executor executor)
handleAsync in interface CompletionStage<V>handleAsync in class CompletableFuture<V>public InternalCompletableFuture<V> whenComplete(@Nonnull BiConsumer<? super V,? super Throwable> action)
whenComplete in interface CompletionStage<V>whenComplete in class CompletableFuture<V>public InternalCompletableFuture<V> whenCompleteAsync(@Nonnull BiConsumer<? super V,? super Throwable> action)
whenCompleteAsync in interface CompletionStage<V>whenCompleteAsync in class CompletableFuture<V>public InternalCompletableFuture<V> whenCompleteAsync(@Nonnull BiConsumer<? super V,? super Throwable> action, @Nonnull Executor executor)
whenCompleteAsync in interface CompletionStage<V>whenCompleteAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> thenCompose(@Nonnull Function<? super V,? extends CompletionStage<U>> fn)
thenCompose in interface CompletionStage<V>thenCompose in class CompletableFuture<V>public <U> InternalCompletableFuture<U> thenComposeAsync(@Nonnull Function<? super V,? extends CompletionStage<U>> fn)
thenComposeAsync in interface CompletionStage<V>thenComposeAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> thenComposeAsync(@Nonnull Function<? super V,? extends CompletionStage<U>> fn, @Nonnull Executor executor)
thenComposeAsync in interface CompletionStage<V>thenComposeAsync in class CompletableFuture<V>public <U,R> InternalCompletableFuture<R> thenCombine(@Nonnull CompletionStage<? extends U> other, @Nonnull BiFunction<? super V,? super U,? extends R> fn)
thenCombine in interface CompletionStage<V>thenCombine in class CompletableFuture<V>public <U,R> InternalCompletableFuture<R> thenCombineAsync(@Nonnull CompletionStage<? extends U> other, @Nonnull BiFunction<? super V,? super U,? extends R> fn)
thenCombineAsync in interface CompletionStage<V>thenCombineAsync in class CompletableFuture<V>public <U,R> InternalCompletableFuture<R> thenCombineAsync(@Nonnull CompletionStage<? extends U> other, @Nonnull BiFunction<? super V,? super U,? extends R> fn, @Nonnull Executor executor)
thenCombineAsync in interface CompletionStage<V>thenCombineAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<Void> thenAcceptBoth(@Nonnull CompletionStage<? extends U> other, @Nonnull BiConsumer<? super V,? super U> action)
thenAcceptBoth in interface CompletionStage<V>thenAcceptBoth in class CompletableFuture<V>public <U> InternalCompletableFuture<Void> thenAcceptBothAsync(@Nonnull CompletionStage<? extends U> other, @Nonnull BiConsumer<? super V,? super U> action)
thenAcceptBothAsync in interface CompletionStage<V>thenAcceptBothAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<Void> thenAcceptBothAsync(@Nonnull CompletionStage<? extends U> other, @Nonnull BiConsumer<? super V,? super U> action, @Nonnull Executor executor)
thenAcceptBothAsync in interface CompletionStage<V>thenAcceptBothAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> runAfterBoth(@Nonnull CompletionStage<?> other, @Nonnull Runnable action)
runAfterBoth in interface CompletionStage<V>runAfterBoth in class CompletableFuture<V>public InternalCompletableFuture<Void> runAfterBothAsync(@Nonnull CompletionStage<?> other, @Nonnull Runnable action)
runAfterBothAsync in interface CompletionStage<V>runAfterBothAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> runAfterBothAsync(@Nonnull CompletionStage<?> other, @Nonnull Runnable action, @Nonnull Executor executor)
runAfterBothAsync in interface CompletionStage<V>runAfterBothAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> applyToEither(@Nonnull CompletionStage<? extends V> other, @Nonnull Function<? super V,U> fn)
applyToEither in interface CompletionStage<V>applyToEither in class CompletableFuture<V>public <U> InternalCompletableFuture<U> applyToEitherAsync(@Nonnull CompletionStage<? extends V> other, @Nonnull Function<? super V,U> fn)
applyToEitherAsync in interface CompletionStage<V>applyToEitherAsync in class CompletableFuture<V>public <U> InternalCompletableFuture<U> applyToEitherAsync(@Nonnull CompletionStage<? extends V> other, @Nonnull Function<? super V,U> fn, @Nonnull Executor executor)
applyToEitherAsync in interface CompletionStage<V>applyToEitherAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> acceptEither(@Nonnull CompletionStage<? extends V> other, @Nonnull Consumer<? super V> action)
acceptEither in interface CompletionStage<V>acceptEither in class CompletableFuture<V>public InternalCompletableFuture<Void> acceptEitherAsync(@Nonnull CompletionStage<? extends V> other, @Nonnull Consumer<? super V> action)
acceptEitherAsync in interface CompletionStage<V>acceptEitherAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> acceptEitherAsync(@Nonnull CompletionStage<? extends V> other, @Nonnull Consumer<? super V> action, @Nonnull Executor executor)
acceptEitherAsync in interface CompletionStage<V>acceptEitherAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> runAfterEither(CompletionStage<?> other, Runnable action)
runAfterEither in interface CompletionStage<V>runAfterEither in class CompletableFuture<V>public InternalCompletableFuture<Void> runAfterEitherAsync(@Nonnull CompletionStage<?> other, @Nonnull Runnable action)
runAfterEitherAsync in interface CompletionStage<V>runAfterEitherAsync in class CompletableFuture<V>public InternalCompletableFuture<Void> runAfterEitherAsync(@Nonnull CompletionStage<?> other, @Nonnull Runnable action, @Nonnull Executor executor)
runAfterEitherAsync in interface CompletionStage<V>runAfterEitherAsync in class CompletableFuture<V>public InternalCompletableFuture<V> toCompletableFuture()
toCompletableFuture in interface CompletionStage<V>toCompletableFuture in class CompletableFuture<V>protected final Object getState()
public final boolean isDone()
protected void onInterruptDetected()
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled in interface Future<V>isCancelled in class CompletableFuture<V>public boolean isCompletedExceptionally()
isCompletedExceptionally in class CompletableFuture<V>public final V join()
join in class CompletableFuture<V>public V joinInternal()
join(), returns the value when complete or throws an unchecked exception if
completed exceptionally. Unlike join(), checked exceptions are not wrapped in CompletionException;
rather they are wrapped in HazelcastExceptions.joinInternal in class InternalCompletableFuture<V>public final V get() throws InterruptedException, ExecutionException
get in interface Future<V>get in class CompletableFuture<V>InterruptedExceptionExecutionExceptionpublic final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<V>get in class CompletableFuture<V>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic V getNow(V valueIfAbsent)
getNow in class CompletableFuture<V>public boolean completeExceptionally(Throwable ex)
completeExceptionally in class CompletableFuture<V>public void obtrudeValue(V value)
obtrudeValue in class CompletableFuture<V>public void obtrudeException(Throwable ex)
obtrudeException in class CompletableFuture<V>public int getNumberOfDependents()
getNumberOfDependents in class CompletableFuture<V>protected void unblockOtherNode(Object waiter, Executor executor)
waiter - the current wait node, see javadoc of state fieldexecutor - the Executor on which to execute the action associated with waiterprotected abstract Exception wrapToInstanceNotActiveException(RejectedExecutionException e)
protected Object resolve(Object value)
value - the resolved state of this futureAbstractInvocationFuture.ExceptionalResult wrapping a Throwable in case value is resolved
to an exception, or the normal completion value. Subclasses may choose to treat
specific normal completion values in a special way (eg deserialize when the completion
value is an instance of Data.protected <U> void unblockApply(@Nonnull Function<? super V,? extends U> function, @Nonnull Executor executor, @Nonnull InternalCompletableFuture<U> future)
protected void unblockRun(@Nonnull Runnable runnable, @Nonnull Executor executor, @Nonnull CompletableFuture<Void> future)
protected <U> void unblockHandle(@Nonnull BiFunction<? super V,Throwable,? extends U> fn, @Nonnull Executor executor, @Nonnull CompletableFuture<U> future)
protected void unblockWhenComplete(@Nonnull BiConsumer<? super V,? super Throwable> biConsumer, @Nonnull Executor executor, @Nonnull CompletableFuture<V> future)
public InternalCompletableFuture<V> exceptionally(@Nonnull Function<Throwable,? extends V> fn)
exceptionally in interface CompletionStage<V>exceptionally in class CompletableFuture<V>public Executor defaultExecutor()
protected <U> void unblockCompose(@Nonnull Function<? super V,? extends CompletionStage<U>> function, @Nonnull Executor executor, @Nonnull CompletableFuture<U> future)
protected <U,R> void unblockCombine(@Nonnull CompletionStage<? extends U> other, @Nonnull BiFunction<? super V,? super U,? extends R> function, @Nonnull Executor executor, @Nonnull InternalCompletableFuture<R> future)
protected <U> void unblockApplyToEither(@Nonnull Function<? super V,U> action, @Nonnull Executor executor, @Nonnull CompletableFuture<U> future)
protected void unblockAcceptEither(@Nonnull Consumer<? super V> action, @Nonnull Executor executor, @Nonnull CompletableFuture<Void> future)
protected CompletableFuture<Void> unblockRunAfterEither(@Nonnull Runnable action, @Nonnull Executor executor, @Nonnull CompletableFuture<Void> future)
public final boolean complete(Object value)
complete in class CompletableFuture<V>value - The type of response to offer.public final boolean completeExceptionallyInternal(Object value)
protected void onComplete()
public String toString()
toString in class CompletableFuture<V>protected static AbstractInvocationFuture.ExceptionalResult wrapThrowable(Object value)
Copyright © 2019 Hazelcast, Inc.. All rights reserved.