Package com.rapidminer.belt.execution
Class SequentialContext
- java.lang.Object
-
- com.rapidminer.belt.execution.SequentialContext
-
-
Constructor Summary
Constructors Constructor Description SequentialContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> java.util.List<T>call(java.util.List<java.util.concurrent.Callable<T>> callables)Executes the givenCallables in parallel, returning their results upon completion.intgetParallelism()Returns the targeted parallelism level of this execution context.booleanisActive()Returnstrueif the execution context is active.voidstop()Stops the execution for this context.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.rapidminer.belt.execution.Context
requireActive
-
-
-
-
Method Detail
-
isActive
public boolean isActive()
Description copied from interface:ContextReturnstrueif the execution context is active. Inactive contexts may reject new jobs.
-
getParallelism
public int getParallelism()
Description copied from interface:ContextReturns the targeted parallelism level of this execution context.- Specified by:
getParallelismin interfaceContext- Returns:
- the targeted parallelism level
-
call
public <T> java.util.List<T> call(java.util.List<java.util.concurrent.Callable<T>> callables) throws java.util.concurrent.ExecutionExceptionDescription copied from interface:ContextExecutes the givenCallables in parallel, returning their results upon completion.If one of the
Callables encounters an exception, the context attempts to cancel the otherCallables and throws anExecutionExceptionthat wraps the exception. If more than oneCallableencounters an exception, only the first observed exception is reported.The method blocks until all
Callableshave completed.Note that the cancellation of one of the
Callables might not interrupt the execution of otherCallables that have already been started. As a consequence, it is recommended that all long-runningCallables periodically check for the cancellation of the computation viaContext.requireActive().- Specified by:
callin interfaceContext- Type Parameters:
T- the type of the values returned from the callables- Parameters:
callables- theCallables to execute in parallel- Returns:
- a list containing the results of the callables
- Throws:
java.util.concurrent.ExecutionException- if the computation threw an exception
-
stop
public void stop()
Stops the execution for this context.
-
-