static
<T>
ForkJoinTask<T>
|
adapt( Runnable runnable, T result)
Returns a new ForkJoinTask that performs the run
method of the given Runnable as its action, and returns
the given result upon join() .
|
static
ForkJoinTask<?>
|
adapt( Runnable runnable)
Returns a new ForkJoinTask that performs the run
method of the given Runnable as its action, and returns
a null result upon join() .
|
static
<T>
ForkJoinTask<T>
|
adapt( Callable<? extends T> callable)
Returns a new ForkJoinTask that performs the call
method of the given Callable as its action, and returns
its result upon join() , translating any checked exceptions
encountered into RuntimeException .
|
boolean
|
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task.
|
final
boolean
|
|
void
|
complete(V value)
Completes this task, and if not already aborted or cancelled,
returning the given value as the result of subsequent
invocations of join and related operations.
|
void
|
completeExceptionally( Throwable ex)
Completes this task abnormally, and if not already aborted or
cancelled, causes it to throw the given exception upon
join and related operations.
|
abstract
boolean
|
exec()
Immediately performs the base action of this task and returns
true if, upon return from this method, this task is guaranteed
to have completed normally.
|
final
ForkJoinTask<V>
|
|
final
V
|
get(long timeout, TimeUnit unit)
Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available.
|
final
V
|
get()
Waits if necessary for the computation to complete, and then
retrieves its result.
|
final
Throwable
|
getException()
Returns the exception thrown by the base computation, or a
CancellationException if cancelled, or null if
none or if the method has not yet completed.
|
final
short
|
|
static
ForkJoinPool
|
getPool()
Returns the pool hosting the current thread, or null
if the current thread is executing outside of any ForkJoinPool.
|
static
int
|
getQueuedTaskCount()
Returns an estimate of the number of tasks that have been
forked by the current worker thread but not yet executed.
|
abstract
V
|
getRawResult()
Returns the result that would be returned by join() , even
if this task completed abnormally, or null if this task
is not known to have been completed.
|
static
int
|
getSurplusQueuedTaskCount()
Returns an estimate of how many more locally queued tasks are
held by the current worker thread than there are other worker
threads that might steal them, or zero if this thread is not
operating in a ForkJoinPool.
|
static
void
|
helpQuiesce()
Possibly executes tasks until the pool hosting the current task
{@linkplain ForkJoinPool#isQuiescent is quiescent}.
|
static
boolean
|
|
final
V
|
invoke()
Commences performing this task, awaits its completion if
necessary, and returns its result, or throws an (unchecked)
RuntimeException or Error if the underlying
computation did so.
|
static
void
|
invokeAll( ForkJoinTask...<?> tasks)
Forks the given tasks, returning when isDone holds for
each task or an (unchecked) exception is encountered, in which
case the exception is rethrown.
|
static
void
|
invokeAll( ForkJoinTask<?> t1, ForkJoinTask<?> t2)
Forks the given tasks, returning when isDone holds for
each task or an (unchecked) exception is encountered, in which
case the exception is rethrown.
|
static
<T extends ForkJoinTask<?>>
Collection<T>
|
invokeAll( Collection<T> tasks)
Forks all tasks in the specified collection, returning when
isDone holds for each task or an (unchecked) exception
is encountered, in which case the exception is rethrown.
|
final
boolean
|
isCancelled()
Returns true if this task was cancelled before it completed
normally.
|
final
boolean
|
|
final
boolean
|
isCompletedNormally()
Returns true if this task completed without throwing an
exception and was not cancelled.
|
final
boolean
|
isDone()
Returns true if this task completed.
|
final
V
|
join()
Returns the result of the computation when it is
done .
|
static
ForkJoinTask<?>
|
peekNextLocalTask()
Returns, but does not unschedule or execute, a task queued by
the current thread but not yet executed, if one is immediately
available.
|
static
ForkJoinTask<?>
|
pollNextLocalTask()
Unschedules and returns, without executing, the next task
queued by the current thread but not yet executed, if the
current thread is operating in a ForkJoinPool.
|
static
ForkJoinTask<?>
|
pollTask()
If the current thread is operating in a ForkJoinPool,
unschedules and returns, without executing, the next task
queued by the current thread but not yet executed, if one is
available, or if not available, a task that was forked by some
other thread, if available.
|
final
void
|
|
final
void
|
quietlyInvoke()
Commences performing this task and awaits its completion if
necessary, without returning its result or throwing its
exception.
|
final
void
|
quietlyJoin()
Joins this task, without returning its result or throwing its
exception.
|
void
|
reinitialize()
Resets the internal bookkeeping state of this task, allowing a
subsequent fork .
|
final
short
|
setForkJoinTaskTag(short newValue)
Atomically sets the tag value for this task and returns the old value.
|
abstract
void
|
setRawResult(V value)
Forces the given value to be returned as a result.
|
boolean
|
tryUnfork()
Tries to unschedule this task for execution.
|