T - the type of results produced by the task.public interface Task<T> extends Runnable, Serializable
| Modifier and Type | Method and Description |
|---|---|
<V> V |
compute(JPPFCallable<V> callable)
Compute a value on the client-side, as the result of the execution of a
JPPFCallable. |
DataProvider |
getDataProvider()
Get the provider of shared data for this task.
|
Exception |
getException()
Get the exception that was raised by this task's execution.
|
String |
getId()
Get the user-assigned id for this task.
|
int |
getPosition()
Returns the position of this task in the job in which it was submitted.
|
T |
getResult()
Get the result of the task execution.
|
Object |
getTaskObject()
Get the
JPPFRunnable-annotated object or POJO wrapped by this task. |
JPPFSchedule |
getTimeoutSchedule()
Get the task timeout schedule configuration.
|
boolean |
isInNode()
Determine whether this task is executing within a node, or locally on the client side.
|
void |
onCancel()
Callback invoked when this task is cancelled.
|
void |
onRestart()
Deprecated.
the task restart feature is inherently unsafe, as it depends on the task
having a unique id among all the tasks running in the grid, which cannot be guaranteed.
This feature has been removed from the management APIs, with no replacement.
|
void |
onTimeout()
Callback invoked when this task times out.
|
void |
setDataProvider(DataProvider dataProvider)
Set the provider of shared data for this task.
|
void |
setException(Exception exception)
Sets the exception that was raised by this task's execution in the
run method. |
void |
setId(String id)
Set the user-assigned id for this task.
|
void |
setPosition(int position)
Set the position of this task in the job in which it was submitted.
|
void |
setResult(T result)
Set the result of the task execution.
|
void |
setTimeoutSchedule(JPPFSchedule timeoutSchedule)
Get the task timeout schedule configuration.
|
T getResult()
void setResult(T result)
result - the result of this task's execution.Exception getException()
Throwable, the exception is embedded into a JPPFException.Exception instance, or null if no exception was raised.void setException(Exception exception)
run method.
The exception is set by the JPPF framework.exception - a ClientApplicationException instance.DataProvider getDataProvider()
DataProvider instance.void setDataProvider(DataProvider dataProvider)
dataProvider - a DataProvider instance.String getId()
void setId(String id)
id - the id as a string.void onCancel()
void onRestart()
void onTimeout()
Object getTaskObject()
JPPFRunnable-annotated object or POJO wrapped by this task.JPPFSchedule getTimeoutSchedule()
JPPFSchedule instance.void setTimeoutSchedule(JPPFSchedule timeoutSchedule)
timeoutSchedule - a JPPFSchedule instance.int getPosition()
int.void setPosition(int position)
position - the position of this task as an int.boolean isInNode()
true if this task is executing in a node, false if it is on the client side.<V> V compute(JPPFCallable<V> callable) throws Exception
JPPFCallable.
Any Throwable raised in the callable's call() method will be thrown as the result of this method.
If the Throwable is an instance of Exception or one of its subclasses, it is thrown as such, otherwise it is wrapped
into a JPPFException.
V - the type of results returned by the callable.callable - the callable to execute on the client side.Exception - if the execution of the callable in the client resulted in a Throwable being raised.JPPFCallableCopyright © 2005-2012 JPPF Team.