Class AbstractJPPFJob<J extends AbstractJPPFJob<J>>

java.lang.Object
org.jppf.client.AbstractJPPFJob<J>
Type Parameters:
J - the type of job.
All Implemented Interfaces:
Serializable, JobStatusHandler, org.jppf.node.protocol.JPPFDistributedJob
Direct Known Subclasses:
JPPFJob

public abstract class AbstractJPPFJob<J extends AbstractJPPFJob<J>> extends Object implements Serializable, org.jppf.node.protocol.JPPFDistributedJob, JobStatusHandler
Instances of this class represent a JPPF job and hold all the required elements: tasks, execution policy, task listener, data provider, priority, blocking indicator.
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • AbstractJPPFJob

      public AbstractJPPFJob()
      Default constructor, creates a blocking job with no data provider, default SLA values and a priority of 0. This constructor generates a pseudo-random id as a string of 32 hexadecimal characters.
    • AbstractJPPFJob

      public AbstractJPPFJob(String jobUuid)
      Default constructor, creates a blocking job with no data provider, default SLA values and a priority of 0. This constructor generates a pseudo-random id as a string of 32 hexadecimal characters.
      Parameters:
      jobUuid - the uuid to assign to this job.
  • Method Details

    • getUuid

      public String getUuid()
      Specified by:
      getUuid in interface org.jppf.node.protocol.JPPFDistributedJob
    • getName

      public String getName()
      Specified by:
      getName in interface org.jppf.node.protocol.JPPFDistributedJob
    • setName

      public J setName(String name)
      Set the user-defined display name for this job.
      Parameters:
      name - the display name as a string.
      Returns:
      this job, for method chaining.
    • getTaskCount

      public int getTaskCount()
      Specified by:
      getTaskCount in interface org.jppf.node.protocol.JPPFDistributedJob
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getResults

      public JobResults getResults()
      Get the object that holds the results of executed tasks.
      Returns:
      a JobResults instance.
    • executedTaskCount

      public int executedTaskCount()
      Get the count of the tasks in this job that haven completed.
      Returns:
      the number of executed tasks in this job.
      Since:
      4.2
    • unexecutedTaskCount

      public int unexecutedTaskCount()
      Get the count of the tasks in this job that haven't yet been executed.
      Returns:
      the number of unexecuted tasks in this job.
      Since:
      4.2
    • getDataProvider

      public org.jppf.node.protocol.DataProvider getDataProvider()
      Get the container for data shared between tasks.
      Returns:
      a DataProvider instance.
    • setDataProvider

      public J setDataProvider(org.jppf.node.protocol.DataProvider dataProvider)
      Set the container for data shared between tasks.
      Parameters:
      dataProvider - a DataProvider instance.
      Returns:
      this job, for method chaining.
    • isBlocking

      public boolean isBlocking()
      Deprecated.
      a job should be submittable either synchronously or asynchronously, regardless of its state. The submission mode is the user's choice at the time of submission, using one of JPPFClient.submit() or JPPFClient.submitAsync().
      Determine whether the execution of this job is blocking on the client side.
      Returns:
      true if the execution is blocking, false otherwise.
    • setBlocking

      public J setBlocking(boolean blocking)
      Deprecated.
      a job should be submittable either synchronously or asynchronously, regardless of its state. The submission mode is the user's choice at the time of submission, using one of JPPFClient.submit() or JPPFClient.submitAsync().
      Specify whether the execution of this job is blocking on the client side.
      Parameters:
      blocking - true if the execution is blocking, false otherwise.
      Returns:
      this job, for method chaining.
    • getSLA

      public org.jppf.node.protocol.JobSLA getSLA()
      Specified by:
      getSLA in interface org.jppf.node.protocol.JPPFDistributedJob
    • getClientSLA

      public org.jppf.node.protocol.JobClientSLA getClientSLA()
      Get the job SLA for the client side.
      Returns:
      an instance of JobSLA.
    • getMetadata

      public org.jppf.node.protocol.JobMetadata getMetadata()
      Specified by:
      getMetadata in interface org.jppf.node.protocol.JPPFDistributedJob
    • setSLA

      public void setSLA(org.jppf.node.protocol.JobSLA jobSLA)
      Get the service level agreement between the job and the server.
      Parameters:
      jobSLA - an instance of JobSLA.
    • setClientSLA

      public void setClientSLA(org.jppf.node.protocol.JobClientSLA jobClientSLA)
      Get the service level agreement between the job and the server.
      Parameters:
      jobClientSLA - an instance of JobSLA.
    • setMetadata

      public void setMetadata(org.jppf.node.protocol.JobMetadata jobMetadata)
      Set this job's metadata.
      Parameters:
      jobMetadata - a JobMetadata instance.
    • readResolve

      protected Object readResolve()
      Resolve this instance after deserialization.
      Returns:
      an instance of Object.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCancelledFlag

      public AtomicBoolean getCancelledFlag()
      Get the flag that determines whether this job has been cancelled.
      Returns:
      an AtomicBoolean instance.
    • getStatus

      public JobStatus getStatus()
      Description copied from interface: JobStatusHandler
      Get the status of the job.
      Specified by:
      getStatus in interface JobStatusHandler
      Returns:
      a JobStatus enumerated value.
    • setStatus

      public void setStatus(JobStatus newStatus)
      Description copied from interface: JobStatusHandler
      Set the status of the job.
      Specified by:
      setStatus in interface JobStatusHandler
      Parameters:
      newStatus - a JobStatus enumerated value.
    • addJobStatusListener

      public void addJobStatusListener(JobStatusListener listener)
      Add a listener to the list of status listeners.
      Parameters:
      listener - the listener to add.
    • removeJobStatusListener

      public void removeJobStatusListener(JobStatusListener listener)
      Remove a listener from the list of status listeners.
      Parameters:
      listener - the listener to remove.
    • fireStatusChangeEvent

      protected void fireStatusChangeEvent(JobStatus newStatus)
      Notify all listeners of a change of status for this job.
      Parameters:
      newStatus - the status for job event.
    • getCancellingFlag

      public AtomicBoolean getCancellingFlag()
      Get the flag that determines whether this job is being cancelled.
      Returns:
      an AtomicBoolean instance.