Package org.apfloat.internal
Class ParallelExecutionStrategy
- java.lang.Object
-
- org.apfloat.internal.ParallelExecutionStrategy
-
- All Implemented Interfaces:
ExecutionStrategy
public class ParallelExecutionStrategy extends java.lang.Object implements ExecutionStrategy
Execution strategy using theParallelRunner.- Since:
- 1.9.0
- Version:
- 1.9.0
-
-
Constructor Summary
Constructors Constructor Description ParallelExecutionStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwait(java.util.concurrent.Future<?> future)While waiting for aFutureto be completed, steal work from any running tasks and run it.
-
-
-
Method Detail
-
wait
public void wait(java.util.concurrent.Future<?> future)
Description copied from interface:ExecutionStrategyWhile waiting for aFutureto be completed, steal work from any running tasks and run it.While this method may functionally appear to be equivalent to just calling
future.get()it should try its best to steal work from any other tasks submitted to theExecutorServiceof the currentApfloatContext. It may in fact steal work using multiple threads, if the currentApfloatContextspecifiesnumberOfProcessorsto be more than one.The purpose of this method is to allow keeping all threads of the
ExecutorService(and CPU cores) maximally busy at all times, while also not running an excessive number of parallel threads (only as many threads as there are CPU cores).- Specified by:
waitin interfaceExecutionStrategy- Parameters:
future- The Future to wait for.
-
-