public class JPPFJob extends Object implements Serializable, JPPFDistributedJob
This class also provides the API for handling JPPF-annotated tasks and POJO tasks.
All jobs have a name. It can be specified by calling setName(String name).
If left unspecified, JPPF will automatically assign a uuid as its value.
| Constructor and Description |
|---|
JPPFJob()
Default constructor, creates a blocking job with no data provider, default SLA values and a priority of 0.
|
JPPFJob(DataProvider dataProvider)
Initialize a blocking job with the specified parameters.
|
JPPFJob(DataProvider dataProvider,
JobSLA jobSLA)
Initialize a blocking job with the specified parameters.
|
JPPFJob(DataProvider dataProvider,
JobSLA jobSLA,
boolean blocking,
TaskResultListener resultsListener)
Initialize a job with the specified parameters.
|
JPPFJob(DataProvider dataProvider,
JobSLA jobSLA,
JPPFJobMetadata jobMetadata,
boolean blocking,
TaskResultListener resultsListener)
Initialize a job with the specified parameters.
|
JPPFJob(DataProvider dataProvider,
JobSLA jobSLA,
TaskResultListener resultsListener)
Initialize a non-blocking job with the specified parameters.
|
JPPFJob(DataProvider dataProvider,
TaskResultListener resultsListener)
Initialize a non-blocking job with the specified parameters.
|
JPPFJob(String jobUuid)
Default constructor, creates a blocking job with no data provider, default SLA values and a priority of 0.
|
JPPFJob(TaskResultListener resultsListener)
Initialize a non-blocking job with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addJobListener(JobListener listener)
Add a listener to the list of job listeners.
|
JPPFTask |
addTask(Object taskObject,
Object... args)
Add a task to this job.
|
JPPFTask |
addTask(String method,
Object taskObject,
Object... args)
Add a POJO task to this job.
|
boolean |
equals(Object obj) |
JobClientSLA |
getClientSLA()
Get the job SLA for the client side.
|
DataProvider |
getDataProvider()
Get the container for data shared between tasks.
|
JobMetadata |
getMetadata()
Get the user-defined metadata associated with this job.
|
String |
getName()
Get the user-defined display name for this job.
|
List<JPPFTask> |
getPendingTasks()
Get the list of tasks that have not yet been executed.
|
<T> JobPersistence<T> |
getPersistenceManager()
Get the persistence manager that enables saving and restoring the state of this job.
|
TaskResultListener |
getResultListener()
Get the listener that receives notifications of completed tasks.
|
JobResults |
getResults()
Get the object that holds the results of executed tasks.
|
JobSLA |
getSLA()
Get the service level agreement between the job and the server.
|
List<JPPFTask> |
getTasks()
Get the list of tasks to execute.
|
String |
getUuid()
Get the universal unique id for this job.
|
int |
hashCode() |
boolean |
isBlocking()
Determine whether the execution of this job is blocking on the client side.
|
protected Object |
readResolve()
Resolve this instance after deserialization.
|
void |
removeJobListener(JobListener listener)
Remove a listener from the list of job listeners.
|
void |
setBlocking(boolean blocking)
Specify whether the execution of this job is blocking on the client side.
|
void |
setClientSLA(JobClientSLA jobClientSLA)
Get the service level agreement between the job and the server.
|
void |
setDataProvider(DataProvider dataProvider)
Set the container for data shared between tasks.
|
void |
setMetadata(JobMetadata jobMetadata)
Set this job's metadata.
|
void |
setName(String name)
Set the user-defined display name for this job.
|
<T> void |
setPersistenceManager(JobPersistence<T> persistenceManager)
Set the persistence manager that enables saving and restoring the state of this job.
|
void |
setResultListener(TaskResultListener resultsListener)
Set the listener that receives notifications of completed tasks.
|
void |
setSLA(JobSLA jobSLA)
Get the service level agreement between the job and the server.
|
String |
toString() |
public JPPFJob()
public JPPFJob(String jobUuid)
jobUuid - the uuid to assign to this job.public JPPFJob(DataProvider dataProvider)
dataProvider - the container for data shared between tasks.public JPPFJob(DataProvider dataProvider, JobSLA jobSLA)
dataProvider - the container for data shared between tasks.jobSLA - service level agreement between job and server.public JPPFJob(TaskResultListener resultsListener)
resultsListener - the listener that receives notifications of completed tasks.public JPPFJob(DataProvider dataProvider, TaskResultListener resultsListener)
dataProvider - the container for data shared between tasks.resultsListener - the listener that receives notifications of completed tasks.public JPPFJob(DataProvider dataProvider, JobSLA jobSLA, TaskResultListener resultsListener)
dataProvider - the container for data shared between tasks.jobSLA - service level agreement between job and server.resultsListener - the listener that receives notifications of completed tasks.public JPPFJob(DataProvider dataProvider, JobSLA jobSLA, boolean blocking, TaskResultListener resultsListener)
dataProvider - the container for data shared between tasks.jobSLA - service level agreement between job and server.blocking - determines whether this job is blocking.resultsListener - the listener that receives notifications of completed tasks.public JPPFJob(DataProvider dataProvider, JobSLA jobSLA, JPPFJobMetadata jobMetadata, boolean blocking, TaskResultListener resultsListener)
dataProvider - the container for data shared between tasks.jobSLA - service level agreement between job and server.jobMetadata - the user-defined job metadata.blocking - determines whether this job is blocking.resultsListener - the listener that receives notifications of completed tasks.public String getUuid()
JPPFDistributedJobgetUuid in interface JPPFDistributedJobpublic String getName()
JPPFDistributedJobgetName in interface JPPFDistributedJobpublic void setName(String name)
name - the display name as a string.public List<JPPFTask> getTasks()
public List<JPPFTask> getPendingTasks()
JPPFTask objects.public JPPFTask addTask(Object taskObject, Object... args) throws JPPFException
JPPFTask,
annotated with JPPFRunnable, or an instance of Runnable or Callable.taskObject - the task to add to this job.args - arguments to use with a JPPF-annotated class.JPPFTask that is either the same as the input if the input is a subclass of JPPFTask,
or a wrapper around the input object in the other cases.JPPFException - if one of the tasks is neither a JPPFTask or a JPPF-annotated class.public JPPFTask addTask(String method, Object taskObject, Object... args) throws JPPFException
taskObject - the task to add to this job.method - the name of the method to execute.args - arguments to use with a JPPF-annotated class.JPPFTask that is a wrapper around the input task object.JPPFException - if one of the tasks is neither a JPPFTask or a JPPF-annotated class.public DataProvider getDataProvider()
DataProvider instance.public void setDataProvider(DataProvider dataProvider)
dataProvider - a DataProvider instance.public TaskResultListener getResultListener()
TaskCompletionListener instance.public void setResultListener(TaskResultListener resultsListener)
resultsListener - a TaskCompletionListener instance.public boolean isBlocking()
public void setBlocking(boolean blocking)
blocking - true if the execution is blocking, false otherwise.public JobSLA getSLA()
JPPFDistributedJobgetSLA in interface JPPFDistributedJobJobSLA.public void setSLA(JobSLA jobSLA)
jobSLA - an instance of JobSLA.public JobClientSLA getClientSLA()
JobSLA.public void setClientSLA(JobClientSLA jobClientSLA)
jobClientSLA - an instance of JobSLA.public JobMetadata getMetadata()
JPPFDistributedJobgetMetadata in interface JPPFDistributedJobJobMetadata instance.public void setMetadata(JobMetadata jobMetadata)
jobMetadata - a JPPFJobMetadata instance.public JobResults getResults()
JobResults instance.public void addJobListener(JobListener listener)
listener - a JobListener instance.public void removeJobListener(JobListener listener)
listener - a JobListener instance.public <T> JobPersistence<T> getPersistenceManager()
T - the type of the keys used by the persistence manager.JobPersistence instance.public <T> void setPersistenceManager(JobPersistence<T> persistenceManager)
T - the type of the keys used by the persistence manager.persistenceManager - a JobPersistence instance.protected Object readResolve()
Object.Copyright © 2005-2012 JPPF Team.