jsr166z.forkjoin
Interface ForkJoinExecutor

All Known Implementing Classes:
ForkJoinPool

public interface ForkJoinExecutor

An object that executes ForkJoinTask computations. This interface does not expose lifecycle, status, or management methods corresponding to implementations, so may be useful as a basis for classes that must restrict access to such methods.


Method Summary
<T> void
execute(ForkJoinTask<T> task)
          Arranges for (asynchronous) execution of the given task.
 int getParallelismLevel()
          Returns an estimate of how many tasks (including subtasks) may execute at once.
<T> T
invoke(ForkJoinTask<T> task)
          Performs the given task; returning its result upon completion
<T> java.util.concurrent.Future<T>
submit(ForkJoinTask<T> task)
          Arranges for (asynchronous) execution of the given task, returning a Future that may be used to obtain results upon completion.
 

Method Detail

execute

<T> void execute(ForkJoinTask<T> task)
Arranges for (asynchronous) execution of the given task.

Parameters:
task - the task
Throws:
java.lang.NullPointerException - if task is null
java.util.concurrent.RejectedExecutionException - if the executor is not in a state that allows execution.

invoke

<T> T invoke(ForkJoinTask<T> task)
Performs the given task; returning its result upon completion

Parameters:
task - the task
Returns:
the task's result
Throws:
java.lang.NullPointerException - if task is null
java.util.concurrent.RejectedExecutionException - if the executor is not in a state that allows execution.

submit

<T> java.util.concurrent.Future<T> submit(ForkJoinTask<T> task)
Arranges for (asynchronous) execution of the given task, returning a Future that may be used to obtain results upon completion.

Parameters:
task - the task
Returns:
a Future that can be used to get the task's results.
Throws:
java.lang.NullPointerException - if task is null
java.util.concurrent.RejectedExecutionException - if the executor is not in a state that allows execution.

getParallelismLevel

int getParallelismLevel()
Returns an estimate of how many tasks (including subtasks) may execute at once. This value normally corresponds to the number of threads available for executing tasks by this executor.

Returns:
the parallelism level