Flashcards in Fork/Join framework Deck (19):
The most important class in the Fork/Join framework. It is a thread pool for running fork/join tasks. It executes an instance of ForkJoinTask.
Executes a given task asynchronously.
void execute(ForkJoinTask> task)
Executes the given task and returns the computed result.
T invoke(ForkJoinTask task)
Executes all the given tasks and returns a list of future objects when all the tasks are completed.
List> invokeAll(Collection extends Callable> tasks)
Returns true if all tasks are completed.
Status checking methods.
getParallelism() getPoolSize() getStealCount()
Gets the number of threads the pool is using.
Executes a submitted task.
ForkJoinTask submit(Callable task)
A lightweight thread like entity representing a task. Defines methods fork() and join()
Attempts to cancel the execution of the task.
boolean cancel(boolean mayInterruptIfRunning)
Executes the task asynchronously.
Returns the result of the computation when the computation is done.
Returns the result of the computation; waits if the computation is not complete.
Starts the execution of the submitted tasks; waits until computation is complete and returns results.
Returns true if the task is cancelled.
Returns true if the task is completed.
A task that can run in a ForkJoinPool. The compute method returns a value.
A task whose compute method does not return a value. This task can run in a fork join pool.