Package jasima.core.experiment
Class ExperimentCompletableFuture
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<Map<String,Object>>
-
- jasima.core.experiment.ExperimentCompletableFuture
-
public class ExperimentCompletableFuture extends CompletableFuture<Map<String,Object>>
Thin wrapper around aFuture, making it cancellable/interruptable and allowing it to be used as aCompletionStage/CompletableFuture. To achieve this, an experiment is submitted to anExecutorService, immediately starting execution.- Author:
- Torsten Hildebrandt
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
-
Constructor Summary
Constructors Constructor Description ExperimentCompletableFuture(Experiment e, ExecutorService es)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel()booleancancel(boolean mayInterruptIfRunning)Map<String,Object>get()Map<String,Object>get(long timeout, TimeUnit unit)ExperimentgetExperiment()booleanisCancelled()booleanisDone()Map<String,Object>joinIgnoreExceptions()-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCompletedExceptionally, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, 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, whenCompleteAsync
-
-
-
-
Constructor Detail
-
ExperimentCompletableFuture
public ExperimentCompletableFuture(Experiment e, ExecutorService es)
-
-
Method Detail
-
getExperiment
public Experiment getExperiment()
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
cancel
public boolean cancel()
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfaceFuture<Map<String,Object>>- Overrides:
isCancelledin classCompletableFuture<Map<String,Object>>
-
isDone
public boolean isDone()
-
get
public Map<String,Object> get() throws ExecutionException, InterruptedException
- Specified by:
getin interfaceFuture<Map<String,Object>>- Overrides:
getin classCompletableFuture<Map<String,Object>>- Throws:
ExecutionExceptionInterruptedException
-
get
public Map<String,Object> get(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException
- Specified by:
getin interfaceFuture<Map<String,Object>>- Overrides:
getin classCompletableFuture<Map<String,Object>>- Throws:
ExecutionExceptionInterruptedExceptionTimeoutException
-
-