public class JPPFAnnotatedTask extends JPPFTask
JPPFRunnable.| Modifier and Type | Field and Description |
|---|---|
protected JPPFTaskCallback |
cancelCallback
A delegate for the
onCancel() method. |
protected TaskObjectWrapper |
taskObjectWrapper
Wrapper around a task that is not an instance of
JPPFTask. |
protected JPPFTaskCallback |
timeoutCallback
A delegate for the
onTimeout() method. |
| Constructor and Description |
|---|
JPPFAnnotatedTask(Object taskObject,
Object... args)
Initialize this task with an object whose class is either annotated with
JPPFRunnable,
an instance of Runnable or an instance of Callable. |
JPPFAnnotatedTask(Object taskObject,
String method,
Object... args)
Initialize this task from a POJO, given a method and its arguments to execute it.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getTaskObject()
Get the
JPPFRunnable-annotated object or POJO wrapped by this task. |
void |
onCancel()
Callback invoked when this task is cancelled.
|
void |
onTimeout()
Callback invoked when this task times out.
|
void |
run()
Run the
JPPFRunnable-annotated method of the task object. |
void |
setCancelCallback(JPPFTaskCallback cancelCallback)
Set the delegate for the
onCancel() method. |
void |
setDataProvider(DataProvider dataProvider)
Override of
JPPFTask.setDataProvider(DataProvider) to enable setting the data provider
onto tasks that are not subclasses of JPPFTask and which implement DataProviderHolder. |
void |
setTimeoutCallback(JPPFTaskCallback timeoutCallback)
Set the delegate for the
onTimeout() method. |
compute, getDataProvider, getException, getId, getPosition, getResult, getTimeoutSchedule, isInNode, setException, setId, setPosition, setResult, setTimeoutScheduleprotected TaskObjectWrapper taskObjectWrapper
JPPFTask.protected JPPFTaskCallback cancelCallback
onCancel() method.protected JPPFTaskCallback timeoutCallback
onTimeout() method.public JPPFAnnotatedTask(Object taskObject, Object... args) throws JPPFException
JPPFRunnable,
an instance of Runnable or an instance of Callable.taskObject - an object that encapsulates the task to execute.args - the optional arguments for a class that has one of its methods annotated with JPPFRunnable.JPPFException - if an error is raised while initializing this task.public JPPFAnnotatedTask(Object taskObject, String method, Object... args) throws JPPFException
taskObject - either an instance of the POJO class if the method is non-static, or a class object if the method is static.method - the name of the method to execute.args - the arguments for the method to execute.JPPFException - if an error is raised while initializing this task.public void run()
JPPFRunnable-annotated method of the task object.Runnable.run()public Object getTaskObject()
JPPFRunnable-annotated object or POJO wrapped by this task.getTaskObject in interface Task<Object>getTaskObject in class JPPFTaskJPPFTask.getTaskObject()public void setCancelCallback(JPPFTaskCallback cancelCallback)
onCancel() method.cancelCallback - a JPPFTaskCallback instance.public void setTimeoutCallback(JPPFTaskCallback timeoutCallback)
onTimeout() method.timeoutCallback - a JPPFTaskCallback instance.public void onCancel()
Taskpublic void onTimeout()
Taskpublic void setDataProvider(DataProvider dataProvider)
JPPFTask.setDataProvider(DataProvider) to enable setting the data provider
onto tasks that are not subclasses of JPPFTask and which implement DataProviderHolder.setDataProvider in interface Task<Object>setDataProvider in class JPPFTaskdataProvider - the data provider to set onto the task.Copyright © 2005-2012 JPPF Team.