Class IndifferentFactoryOfTheFuture
java.lang.Object
space.arim.omnibus.util.concurrent.impl.AbstractFactoryOfTheFuture
space.arim.omnibus.util.concurrent.impl.IndifferentFactoryOfTheFuture
- All Implemented Interfaces:
Executor, FactoryOfTheFuture, SynchronousExecutor
FactoryOfTheFuture implementation which regards Sync method calls to
the CentralisedFutures produced by the factory as identical to Async
calls using the default executor. Specifically, this implementation produces
IndifferentCentralisedFutures. It is
suitable for applications where there is no "main" or "primary" thread. Calls to
executeSync(Runnable) are treated identically as those to AbstractFactoryOfTheFuture.execute(Runnable).- Author:
- A248
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteSync(Runnable command) Runs the Runnable on the main thread, if the application has a main thread, else executes it in a thread pool suitable for computational work such asForkJoinPool.commonPool()<U> CentralisedFuture<U> Creates a new, incomplete future.Methods inherited from class AbstractFactoryOfTheFuture
allOf, allOf, completedFuture, completedStage, copyFuture, copyStage, execute, failedFuture, failedStage, runAsync, runAsync, runSync, supplyAsync, supplyAsync, supplySync
-
Constructor Details
-
IndifferentFactoryOfTheFuture
public IndifferentFactoryOfTheFuture()
-
-
Method Details
-
newIncompleteFuture
Description copied from class:AbstractFactoryOfTheFutureCreates a new, incomplete future. The result of this method is used in implementing variousFactoryOfTheFuturespecifications.- Specified by:
newIncompleteFuturein interfaceFactoryOfTheFuture- Specified by:
newIncompleteFuturein classAbstractFactoryOfTheFuture- Type Parameters:
U- the result type of the future- Returns:
- a new incomplete future
-
executeSync
Description copied from interface:FactoryOfTheFutureRuns the Runnable on the main thread, if the application has a main thread, else executes it in a thread pool suitable for computational work such asForkJoinPool.commonPool()- Parameters:
command- the runnable to run synchronously with the main thread
-