public class ForkJoinExecutorService extends AbstractExecutorService
ForkJoinExecutorService is an ExecutorService,
for efficient nested parallelization.
The ForkJoinPool is an ExecutorService that provides
an entry point to a technique called work-steeling.
Work-steeling allows good performance for nested parallelization.
But calling ForkJoinPool.submit(java.util.concurrent.ForkJoinTask<T>) or ForkJoinPool.invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>>)
alone, won't result in any work-steeling and performance boost.
It's necessary to use ForkJoinTasks and their methods
fork or invokeAll to benefit from work-steeling.
ForkJoinExecutorService is an ExecutorService that internally calls ForkJoinTask.fork() and ForkJoinTask.invokeAll(...) and therefore directly achieves good performance by work-steeling.
ForkJoinExecutorService is not a fully functional ExecutorService.
Methods like shutdownNow(), awaitTermination(long, TimeUnit)
and invokeAll(Collection, long, TimeUnit) are not implemented.
| Constructor and Description |
|---|
ForkJoinExecutorService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long l,
TimeUnit timeUnit) |
void |
execute(Runnable runnable) |
int |
getParallelism() |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> collection) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> collection,
long l,
TimeUnit timeUnit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> callable) |
Future<?> |
submit(Runnable runnable) |
<T> Future<T> |
submit(Runnable runnable,
T t) |
invokeAny, invokeAny, newTaskFor, newTaskForpublic int getParallelism()
public void shutdown()
public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long l,
TimeUnit timeUnit)
throws InterruptedException
InterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection) throws InterruptedException
invokeAll in interface ExecutorServiceinvokeAll in class AbstractExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit) throws InterruptedException
invokeAll in interface ExecutorServiceinvokeAll in class AbstractExecutorServiceInterruptedExceptionpublic Future<?> submit(Runnable runnable)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic <T> Future<T> submit(Runnable runnable, T t)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic <T> Future<T> submit(Callable<T> callable)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic void execute(Runnable runnable)
Copyright © 2015–2022 ImgLib2. All rights reserved.