public abstract class ComputeJobAdapter extends Object implements ComputeJob, Callable<Object>
ComputeJob
implementations. It provides the
following functionality:
ComputeJob.cancel()
method and ability
to check whether cancellation occurred with isCancelled()
method.
setArguments(Object...)
and argument(int)
methods.
Modifier | Constructor and Description |
---|---|
protected |
ComputeJobAdapter()
No-arg constructor.
|
protected |
ComputeJobAdapter(Object... args)
Creates job with specified arguments.
|
protected |
ComputeJobAdapter(@Nullable Object arg)
Creates job with one arguments.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
argument(int idx)
Gets job argument.
|
protected @Nullable Object[] |
arguments()
Gets array of job arguments.
|
Object |
call() |
void |
cancel()
This method is called when system detects that completion of this
job can no longer alter the overall outcome (for example, when parent task
has already reduced the results).
|
protected boolean |
isCancelled()
This method tests whether or not this job was cancelled.
|
void |
setArguments(Object... args)
Sets given arguments.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute
protected ComputeJobAdapter()
protected ComputeJobAdapter(@Nullable @Nullable Object arg)
arg
- Job argument.protected ComputeJobAdapter(@Nullable Object... args)
args
- Optional job arguments.public void setArguments(@Nullable Object... args)
args
- Optional job arguments to set.public void cancel()
IgniteFuture.cancel()
is called.
Note that job cancellation is only a hint, and just like with
Thread.interrupt()
method, it is really up to the actual job
instance to gracefully finish execution and exit.
cancel
in interface ComputeJob
protected final boolean isCancelled()
This method can be periodically called in ComputeJob.execute()
method
implementation to check whether or not this job cancelled. Note that system
calls cancel()
method only as a hint and this is a responsibility of
the implementation of the job to properly cancel its execution.
true
if this job was cancelled, false
otherwise.@Nullable public <T> T argument(int idx)
T
- Type of the argument to return.idx
- Index of the argument.NullPointerException
- Thrown in case when there no arguments set.IllegalArgumentException
- Thrown if index is invalid.@Nullable protected @Nullable Object[] arguments()
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024