public class ParallelRunner extends Object
ParallelRunnableobjects in parallel using multiple threads.
The ParallelRunner assumes that the current
ApfloatContext returns an
ExecutorService that is limited to a number of threads that is
one less than the number of processors. This way, when also the current thread
runs batches from the
ParallelRunnable, CPU utilization should be
maximized but only so that no more threads are actively executing than the
number of processors.
|Modifier and Type||Method and Description|
Run a ParallelRunnable object in parallel using multiple threads.
While waiting for a
public static void runParallel(ParallelRunnable parallelRunnable) throws ApfloatRuntimeException
ApfloatContext.getExecutorService()is limited to using one thread less than the number of processors. This maximizes CPU usage, When the
ParallelRunnableis also run from the current thread.
parallelRunnable- The ParallelRunnable to be run.
public static void wait(Future<?> future)
Futureto be completed, steal a minimal amount of work from any running task and run it.
future- The Future to wait for.
Copyright © 2017. All rights reserved.