org.jppf.client.taskwrapper
Class JPPFAnnotatedTask

java.lang.Object
  extended by org.jppf.server.protocol.JPPFTask
      extended by org.jppf.client.taskwrapper.JPPFAnnotatedTask
All Implemented Interfaces:
Serializable, Runnable

public class JPPFAnnotatedTask
extends JPPFTask

JPPF task wrapper for an object whose class is annotated with JPPFRunnable.

Author:
Laurent Cohen
See Also:
Serialized Form

Field Summary
protected  TaskObjectWrapper taskObjectWrapper
          Wrapper around a task that is not an instance of JPPFTask.
 
Fields inherited from class org.jppf.server.protocol.JPPFTask
listeners
 
Constructor Summary
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.
 
Method Summary
 Object getTaskObject()
          Get the JPPFRunnable-annotated object or POJO wrapped by this task.
 void run()
          Run the JPPFRunnable-annotated method of the task object.
 
Methods inherited from class org.jppf.server.protocol.JPPFTask
addJPPFTaskListener, fireNotification, getDataProvider, getException, getId, getListeners, getPosition, getResult, getTimeout, getTimeoutDate, getTimeoutDateFormat, getTimeoutFormat, getTimeoutSchedule, onCancel, onRestart, onTimeout, removeJPPFTaskListener, setDataProvider, setException, setId, setPosition, setResult, setTimeout, setTimeoutDate, setTimeoutDate, setTimeoutSchedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskObjectWrapper

protected TaskObjectWrapper taskObjectWrapper
Wrapper around a task that is not an instance of JPPFTask.

Constructor Detail

JPPFAnnotatedTask

public JPPFAnnotatedTask(Object taskObject,
                         Object... args)
                  throws JPPFException
Initialize this task with an object whose class is either annotated with JPPFRunnable, an instance of Runnable or an instance of Callable.

Parameters:
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.
Throws:
JPPFException - if an error is raised while initializing this task.

JPPFAnnotatedTask

public JPPFAnnotatedTask(Object taskObject,
                         String method,
                         Object... args)
                  throws JPPFException
Initialize this task from a POJO, given a method and its arguments to execute it.

Parameters:
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.
Throws:
JPPFException - if an error is raised while initializing this task.
Method Detail

run

public void run()
Run the JPPFRunnable-annotated method of the task object.

See Also:
Runnable.run()

getTaskObject

public Object getTaskObject()
Get the JPPFRunnable-annotated object or POJO wrapped by this task.

Overrides:
getTaskObject in class JPPFTask
Returns:
an objet or class that is JPPF-annotated.
See Also:
JPPFTask.getTaskObject()


Copyright © 2005-2010 JPPF Team.