Class BaseCentralisedFuture<T>
java.lang.Object
java.util.concurrent.CompletableFuture<T>
space.arim.omnibus.util.concurrent.CentralisedFuture<T>
space.arim.omnibus.util.concurrent.impl.BaseCentralisedFuture<T>
- Type Parameters:
T- the result type of the future
- All Implemented Interfaces:
CompletionStage<T>, Future<T>, ReactionStage<T>
Implementation of
CentralisedFuture using a SynchronousExecutor
for Sync methods.- Author:
- A248
-
Nested Class Summary
Nested classes/interfaces inherited from class CompletableFuture
CompletableFuture.AsynchronousCompletionTask -
Constructor Summary
ConstructorsConstructorDescriptionBaseCentralisedFuture(SynchronousExecutor syncExecutor) Creates a new incomplete future, with aSynchronousExecutorto use for executing tasks synchronously to the main thread. -
Method Summary
Modifier and TypeMethodDescriptionacceptEitherSync(CompletionStage<? extends T> other, Consumer<? super T> action) <U> CentralisedFuture<U> applyToEitherSync(CompletionStage<? extends T> other, Function<? super T, U> fn) completeSync(Supplier<? extends T> supplier) <U> CentralisedFuture<U> handleSync(BiFunction<? super T, Throwable, ? extends U> fn) <U> CentralisedFuture<U> runAfterBothSync(CompletionStage<?> other, Runnable action) runAfterEitherSync(CompletionStage<?> other, Runnable action) <U> CentralisedFuture<Void> thenAcceptBothSync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thenAcceptSync(Consumer<? super T> action) <U> CentralisedFuture<U> thenApplySync(Function<? super T, ? extends U> fn) <U,V> CentralisedFuture <V> thenCombineSync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U> CentralisedFuture<U> thenComposeSync(Function<? super T, ? extends CompletionStage<U>> fn) thenRunSync(Runnable action) whenCompleteSync(BiConsumer<? super T, ? super Throwable> action) Methods inherited from class CentralisedFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, completeAsync, completeAsync, completeOnTimeout, copy, exceptionally, handle, handleAsync, handleAsync, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsyncMethods inherited from class CompletableFuture
allOf, anyOf, cancel, complete, completedFuture, completedStage, completeExceptionally, defaultExecutor, delayedExecutor, delayedExecutor, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, isCancelled, isCompletedExceptionally, isDone, join, obtrudeException, obtrudeValue, runAsync, runAsync, supplyAsync, supplyAsync, toString
-
Constructor Details
-
BaseCentralisedFuture
Creates a new incomplete future, with aSynchronousExecutorto use for executing tasks synchronously to the main thread.- Parameters:
syncExecutor- the synchronous executor to use for Sync tasks
-
-
Method Details
-
newIncompleteFuture
- Specified by:
newIncompleteFuturein classCentralisedFuture<T>
-
minimalCompletionStage
- Specified by:
minimalCompletionStagein classCentralisedFuture<T>
-
thenApplySync
- Specified by:
thenApplySyncin interfaceReactionStage<T>- Specified by:
thenApplySyncin classCentralisedFuture<T>
-
thenAcceptSync
- Specified by:
thenAcceptSyncin interfaceReactionStage<T>- Specified by:
thenAcceptSyncin classCentralisedFuture<T>
-
thenRunSync
- Specified by:
thenRunSyncin interfaceReactionStage<T>- Specified by:
thenRunSyncin classCentralisedFuture<T>
-
thenCombineSync
public <U,V> CentralisedFuture<V> thenCombineSync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombineSyncin interfaceReactionStage<T>- Specified by:
thenCombineSyncin classCentralisedFuture<T>
-
thenAcceptBothSync
public <U> CentralisedFuture<Void> thenAcceptBothSync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothSyncin interfaceReactionStage<T>- Specified by:
thenAcceptBothSyncin classCentralisedFuture<T>
-
runAfterBothSync
- Specified by:
runAfterBothSyncin interfaceReactionStage<T>- Specified by:
runAfterBothSyncin classCentralisedFuture<T>
-
applyToEitherSync
public <U> CentralisedFuture<U> applyToEitherSync(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherSyncin interfaceReactionStage<T>- Specified by:
applyToEitherSyncin classCentralisedFuture<T>
-
acceptEitherSync
public CentralisedFuture<Void> acceptEitherSync(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherSyncin interfaceReactionStage<T>- Specified by:
acceptEitherSyncin classCentralisedFuture<T>
-
runAfterEitherSync
- Specified by:
runAfterEitherSyncin interfaceReactionStage<T>- Specified by:
runAfterEitherSyncin classCentralisedFuture<T>
-
thenComposeSync
public <U> CentralisedFuture<U> thenComposeSync(Function<? super T, ? extends CompletionStage<U>> fn) - Specified by:
thenComposeSyncin interfaceReactionStage<T>- Specified by:
thenComposeSyncin classCentralisedFuture<T>
-
whenCompleteSync
- Specified by:
whenCompleteSyncin interfaceReactionStage<T>- Specified by:
whenCompleteSyncin classCentralisedFuture<T>
-
handleSync
- Specified by:
handleSyncin interfaceReactionStage<T>- Specified by:
handleSyncin classCentralisedFuture<T>
-
completeSync
- Specified by:
completeSyncin classCentralisedFuture<T>
-