Class PgxFuture<T>
java.lang.Object
java.util.concurrent.CompletableFuture<T>
oracle.pgx.api.PgxFuture<T>
- All Implemented Interfaces:
CompletionStage<T>, Future<T>
A PGX-specific extension of
CompletableFuture-
Nested Class Summary
Nested classes/interfaces inherited from class CompletableFuture
CompletableFuture.AsynchronousCompletionTaskNested classes/interfaces inherited from interface Future
Future.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()If given promise completes exceptionally because it was canceled,CompletableFuture.cancel(boolean)gets called on this promise as well.static <T> PgxFuture<T> completedFuture(T arg) exceptionally(Function<Throwable, ? extends T> fn) static <T> PgxFuture<T> exceptionallyCompletedFuture(Throwable throwable) get()compute statistics about the progress and estimation to finish a PgxFuture Currently only supported for Graph loading features<U> PgxFuture<U> handle(BiFunction<? super T, Throwable, ? extends U> fn) booleanjoin()thenAccept(Consumer<? super T> block) <U> PgxFuture<U> <U> PgxFuture<U> thenApplyAsync(Function<? super T, ? extends U> function, Executor executor) <U,V> PgxFuture <V> thenCombine(CompletableFuture<? extends U> other, BiFunction<? super T, ? super U, ? extends V> function) thenComplete(PgxFuture<T> promise) completes the given promise whenever this completes.thenComplete(PgxFuture<T> promise, Runnable cleanup) completes the given promise whenever this completes.<U> PgxFuture<U> thenCompose(Function<? super T, ? extends CompletionStage<U>> function) <U> PgxFuture<U> thenReturn(U result) A future that discards its result and returns the given parameter on completion.Methods inherited from class CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeAsync, completeAsync, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, exceptionNow, failedFuture, failedStage, getNumberOfDependents, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, resultNow, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, state, supplyAsync, supplyAsync, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
-
Constructor Details
-
PgxFuture
public PgxFuture()
-
-
Method Details
-
allOf
-
completedFuture
-
exceptionallyCompletedFuture
-
thenApply
- Specified by:
thenApplyin interfaceCompletionStage<T>- Overrides:
thenApplyin classCompletableFuture<T>
-
thenApplyAsync
public <U> PgxFuture<U> thenApplyAsync(Function<? super T, ? extends U> function, Executor executor) - Specified by:
thenApplyAsyncin interfaceCompletionStage<T>- Overrides:
thenApplyAsyncin classCompletableFuture<T>
-
thenCombine
public <U,V> PgxFuture<V> thenCombine(CompletableFuture<? extends U> other, BiFunction<? super T, ? super U, ? extends V> function) -
thenReturn
A future that discards its result and returns the given parameter on completion.Shortcut for
thenApply(t -> result).- Parameters:
result- the result to return on completion of this future- Returns:
- a future returning the result on completion
-
get
- Specified by:
getin interfaceFuture<T>- Overrides:
getin classCompletableFuture<T>- Throws:
InterruptedExceptionExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<T>- Overrides:
getin classCompletableFuture<T>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
getNow
- Overrides:
getNowin classCompletableFuture<T>
-
join
- Overrides:
joinin classCompletableFuture<T>
-
thenAccept
- Specified by:
thenAcceptin interfaceCompletionStage<T>- Overrides:
thenAcceptin classCompletableFuture<T>
-
handle
- Specified by:
handlein interfaceCompletionStage<T>- Overrides:
handlein classCompletableFuture<T>
-
thenCompose
- Specified by:
thenComposein interfaceCompletionStage<T>- Overrides:
thenComposein classCompletableFuture<T>
-
exceptionally
- Specified by:
exceptionallyin interfaceCompletionStage<T>- Overrides:
exceptionallyin classCompletableFuture<T>
-
thenComplete
-
thenComplete
completes the given promise whenever this completes.If this completes exceptionally, the given promise is completed exceptionally as well.
- Parameters:
promise-cleanup- to be run upon completion (can be null)- Returns:
- the given promise
-
cancel
public boolean cancel() -
cancelOn
If given promise completes exceptionally because it was canceled,CompletableFuture.cancel(boolean)gets called on this promise as well.- Parameters:
promise- If given promise completes exceptionally because it was canceled,CompletableFuture.cancel(boolean)gets called on this promise as well. If given promise completes exceptionally (regardless of the causing exception) and this promise has started or is done, this promise is then rolled back.- Returns:
- this
-
isConsumed
public boolean isConsumed() -
getProgress
compute statistics about the progress and estimation to finish a PgxFuture Currently only supported for Graph loading features- Parameters:
future- a pgx future- Returns:
- progress of the future execution
-