public class InternalCompletableFuture<V> extends CompletableFuture<V>
CompletableFuture supporting a joinInternal()
variant with more relaxed exception throwing conventions.
This is the base class for all internally used CompletableFutures.
Does not perform optional deserialization. Uses ForkJoinPool.commonPool()
or thread-per-task executor as default async executor, as CompletableFuture does.
Provides static factory methods for more specific implementations supporting custom
default async executor or deserialization of completion value.CompletableFuture.AsynchronousCompletionTask| Constructor and Description |
|---|
InternalCompletableFuture() |
| Modifier and Type | Method and Description |
|---|---|
static <V> InternalCompletableFuture<V> |
completedExceptionally(Throwable t)
Creates a new
InternalCompletableFuture that is completed exceptionally with the
given Throwable. |
static <V> InternalCompletableFuture<V> |
completedExceptionally(Throwable t,
Executor defaultAsyncExecutor)
Creates a new
InternalCompletableFuture that is completed exceptionally with the
given Throwable and uses the given Executor as default executor for
next stages registered with default async methods. |
static <U> BiConsumer<U,? super Throwable> |
completingCallback(CompletableFuture<U> future) |
V |
joinInternal()
Similarly to
CompletableFuture.join(), returns the value when complete or throws an unchecked exception if
completed exceptionally. |
static <V> InternalCompletableFuture<V> |
newCompletedFuture(Object result)
Creates a new
InternalCompletableFuture that is already completed with the value given
as argument as its completion value. |
static <V> InternalCompletableFuture<V> |
newCompletedFuture(Object result,
Executor defaultAsyncExecutor)
Creates a new
InternalCompletableFuture that is already completed with the value given
as argument as its completion value and the provided defaultAsyncExecutor as the default
executor for execution of next stages registered with default async methods (i.e. |
static <V> InternalCompletableFuture<V> |
newCompletedFuture(Object result,
SerializationService serializationService)
Creates a new
InternalCompletableFuture that is already completed with the value given
as argument as its completion value. |
static <V> InternalCompletableFuture<V> |
newCompletedFuture(Object result,
SerializationService serializationService,
Executor defaultAsyncExecutor)
Creates a new
InternalCompletableFuture that is already completed with the value given
as argument as its completion value and the provided defaultAsyncExecutor as the default
executor for execution of next stages registered with default async methods (i.e. |
static <V> InternalCompletableFuture<V> |
newDelegatingFuture(SerializationService serializationService,
InternalCompletableFuture<Data> future)
Creates a new
InternalCompletableFuture that delegates to the given future and
deserializes its completion value of type Data. |
static <V> InternalCompletableFuture<V> |
withExecutor(Executor defaultAsyncExecutor)
Creates a new incomplete
InternalCompletableFuture that uses the given Executor
as default executor for next stages registered with default async methods. |
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completedFuture, completeExceptionally, exceptionally, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, obtrudeException, obtrudeValue, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsyncpublic V joinInternal()
CompletableFuture.join(), returns the value when complete or throws an unchecked exception if
completed exceptionally. Unlike CompletableFuture.join(), checked exceptions are not wrapped in CompletionException;
rather they are wrapped in HazelcastExceptions.public static <V> InternalCompletableFuture<V> newCompletedFuture(Object result)
InternalCompletableFuture that is already completed with the value given
as argument as its completion value.result - completion valueresult as its completion value.public static <V> InternalCompletableFuture<V> newCompletedFuture(Object result, @Nonnull SerializationService serializationService)
InternalCompletableFuture that is already completed with the value given
as argument as its completion value. If the given result is of type Data, then
it is deserialized before being passed on as argument to a Function, Consumer,
BiFunction or BiConsumer further computation stage or before being returned
from one of the methods which return the future's value in a blocking way.result - the result of the completed future.serializationService - instance of SerializationServiceInternalCompletableFuture completed with the given value
as result, optionally deserializing the completion valuepublic static <V> InternalCompletableFuture<V> newCompletedFuture(Object result, @Nonnull Executor defaultAsyncExecutor)
InternalCompletableFuture that is already completed with the value given
as argument as its completion value and the provided defaultAsyncExecutor as the default
executor for execution of next stages registered with default async methods (i.e. *Async methods
which do not have an explicit Executor argument).result - the result of the completed future.defaultAsyncExecutor - the executor to use for execution of next computation
stages, when registered with default async methodsInternalCompletableFuture completed with the given value
as resultpublic static <V> InternalCompletableFuture<V> newCompletedFuture(Object result, @Nonnull SerializationService serializationService, @Nonnull Executor defaultAsyncExecutor)
InternalCompletableFuture that is already completed with the value given
as argument as its completion value and the provided defaultAsyncExecutor as the default
executor for execution of next stages registered with default async methods (i.e. *Async methods
which do not have an explicit Executor argument). If the given result is of type
Data, then it is deserialized before being passed on as argument to a Function,
Consumer, BiFunction or BiConsumer further computation stage or before
being returned from one of the methods which return the future's value in a blocking way.result - the result of the completed future.defaultAsyncExecutor - the executor to use for execution of next computation
stages, when registered with default async methodsInternalCompletableFuture completed with the given value
as resultpublic static <V> InternalCompletableFuture<V> completedExceptionally(@Nonnull Throwable t)
InternalCompletableFuture that is completed exceptionally with the
given Throwable.t - the Throwable with which the new future is completedInternalCompletableFuture that is completed exceptionallypublic static <V> InternalCompletableFuture<V> completedExceptionally(@Nonnull Throwable t, @Nonnull Executor defaultAsyncExecutor)
InternalCompletableFuture that is completed exceptionally with the
given Throwable and uses the given Executor as default executor for
next stages registered with default async methods.t - the Throwable with which the new future is completeddefaultAsyncExecutor - the executor to use for execution of next computation
stages, when registered with default async methodsInternalCompletableFuture that is completed exceptionallypublic static <V> InternalCompletableFuture<V> withExecutor(@Nonnull Executor defaultAsyncExecutor)
InternalCompletableFuture that uses the given Executor
as default executor for next stages registered with default async methods.defaultAsyncExecutor - the executor to use for execution of next computation
stages, when registered with default async methodsInternalCompletableFuturepublic static <V> InternalCompletableFuture<V> newDelegatingFuture(@Nonnull SerializationService serializationService, @Nonnull InternalCompletableFuture<Data> future)
InternalCompletableFuture that delegates to the given future and
deserializes its completion value of type Data.serializationService - serialization servicefuture - the InternalCompletableFuture<Data> to be decorated.InternalCompletableFuturepublic static <U> BiConsumer<U,? super Throwable> completingCallback(CompletableFuture<U> future)
future - BiConsumer to be used with CompletableFuture.whenComplete(BiConsumer) and variants
that completes the future given as argument normally or exceptionally, depending on whether
Throwable argument is nullCopyright © 2019 Hazelcast, Inc.. All rights reserved.