Class AbstractClientJob

java.lang.Object
org.jppf.client.balancer.AbstractClientJob
Direct Known Subclasses:
ClientJob

public abstract class AbstractClientJob extends Object
Abstract class that support job state management.
Author:
Martin JANDA
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final JPPFJob
    The underlying task bundle.
    protected ClientJob
    Instance of parent broadcast job.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Initialized abstract client job with task bundle and list of tasks to execute.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    acceptsChannel(org.jppf.execute.ExecutorChannel<?> channel)
    Determine whether this job can be sent to the specified channel.
    void
    addChannel(org.jppf.execute.ExecutorChannel<?> channel)
    Add a channel to this job.
    void
    addOnDone(Runnable runnable)
    Registers instance to be called on job finish.
    boolean
    cancel(boolean mayInterruptIfRunning)
    Cancels this job.
    void
    Clear the channels used to dispatch this job.
    protected void
    Called when task was cancelled or finished.
    org.jppf.node.protocol.JobClientSLA
    Get the service level agreement between the job and the client.
    Get the underlying task bundle.
    long
    Get the job received time.
    org.jppf.node.protocol.JobMetadata
    Get the job metadata.
    Get the user-defined display name for this job.
    long
    Get the time at which this wrapper was added to the queue.
    org.jppf.node.protocol.JobSLA
    Get the service level agreement between the job and the server.
    Get the universal unique id for this job.
    boolean
     
    boolean
    Whether this job is being cancelled.
    boolean
    Whether this job is being cancelled or has already been cancelled.
    boolean
     
    boolean
    Get the job expired indicator.
    boolean
    Get the job pending indicator.
    void
    Notifies that job has expired.
    void
    preparePolicy(org.jppf.node.policy.ExecutionPolicy policy)
    Set the parameters needed as bounded variables fro scripted execution policies.
    void
    removeChannel(org.jppf.execute.ExecutorChannel<?> channel)
    Add a channel to this job.
    void
    Deregisters instance to be called on job finish.
    void
    setClientSLA(org.jppf.node.protocol.JobClientSLA clientSla)
    Get the service level agreement between the job and the client.
    void
    setJobReceivedTime(long jobReceivedTime)
    Set the job received time.
    void
    setMetadata(org.jppf.node.protocol.JobMetadata metadata)
    Set the job metadata.
    void
    Set the user-defined display name for this job.
    void
    setPending(boolean pending)
    Set the job pending indicator.
    void
    setQueueEntryTime(long queueEntryTime)
    Set the time at which this wrapper was added to the queue.
    void
    setSLA(org.jppf.node.protocol.JobSLA sla)
    Get the service level agreement between the job and the server.
    void
    Set the universal unique id for this job.
    protected final boolean
    Updates status to new value if old value is equal to expect.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • parentJob

      protected ClientJob parentJob
      Instance of parent broadcast job.
    • job

      protected final JPPFJob job
      The underlying task bundle.
  • Constructor Details

    • AbstractClientJob

      protected AbstractClientJob(JPPFJob job)
      Initialized abstract client job with task bundle and list of tasks to execute.
      Parameters:
      job - underlying task bundle.
  • Method Details

    • getJob

      public JPPFJob getJob()
      Get the underlying task bundle.
      Returns:
      a ClientTaskBundle instance.
    • getUuid

      public String getUuid()
      Get the universal unique id for this job.
      Returns:
      the uuid as a string.
    • setUuid

      public void setUuid(String uuid)
      Set the universal unique id for this job.
      Parameters:
      uuid - the universal unique id.
    • getName

      public String getName()
      Get the user-defined display name for this job. This is the name displayed in the administration console.
      Returns:
      the name as a string.
    • setName

      public void setName(String name)
      Set the user-defined display name for this job.
      Parameters:
      name - the display name as a string.
    • getSLA

      public org.jppf.node.protocol.JobSLA getSLA()
      Get the service level agreement between the job and the server.
      Returns:
      an instance of JobSLA.
    • getClientSLA

      public org.jppf.node.protocol.JobClientSLA getClientSLA()
      Get the service level agreement between the job and the client.
      Returns:
      an instance of JobSLA.
    • getMetadata

      public org.jppf.node.protocol.JobMetadata getMetadata()
      Get the job metadata.
      Returns:
      an instance of JobMetadata.
    • setMetadata

      public void setMetadata(org.jppf.node.protocol.JobMetadata metadata)
      Set the job metadata.
      Parameters:
      metadata - an instance of JobMetadata.
    • setSLA

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

      public void setClientSLA(org.jppf.node.protocol.JobClientSLA clientSla)
      Get the service level agreement between the job and the client.
      Parameters:
      clientSla - an instance of JobClientSLA.
    • isJobExpired

      public boolean isJobExpired()
      Get the job expired indicator.
      Returns:
      true if job has expired, false otherwise.
    • jobExpired

      public void jobExpired()
      Notifies that job has expired.
    • isPending

      public boolean isPending()
      Get the job pending indicator.
      Returns:
      true if job is pending, false otherwise.
    • setPending

      public void setPending(boolean pending)
      Set the job pending indicator.
      Parameters:
      pending - true to indicate that job is pending, false otherwise
    • updateStatus

      protected final boolean updateStatus(ClientJobStatus expect, ClientJobStatus newStatus)
      Updates status to new value if old value is equal to expect.
      Parameters:
      expect - the expected value.
      newStatus - the new value.
      Returns:
      true if new status was set.
    • isDone

      public boolean isDone()
      Returns:
      true when job is cancelled or finished normally.
    • isCancelled

      public boolean isCancelled()
      Returns:
      true when job was cancelled.
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Cancels this job.
      Parameters:
      mayInterruptIfRunning - true if the thread executing this task should be interrupted.
      Returns:
      whether cancellation was successful.
    • done

      protected void done()
      Called when task was cancelled or finished.
    • addOnDone

      public void addOnDone(Runnable runnable)
      Registers instance to be called on job finish.
      Parameters:
      runnable - Runnable to be called on job finish.
    • removeOnDone

      public void removeOnDone(Runnable runnable)
      Deregisters instance to be called on job finish.
      Parameters:
      runnable - Runnable to be called on job finish.
    • getJobReceivedTime

      public long getJobReceivedTime()
      Get the job received time.
      Returns:
      the time in milliseconds as a long value.
    • setJobReceivedTime

      public void setJobReceivedTime(long jobReceivedTime)
      Set the job received time.
      Parameters:
      jobReceivedTime - the time in milliseconds as a long value.
    • getQueueEntryTime

      public long getQueueEntryTime()
      Get the time at which this wrapper was added to the queue.
      Returns:
      the time in milliseconds as a long value.
    • setQueueEntryTime

      public void setQueueEntryTime(long queueEntryTime)
      Set the time at which this wrapper was added to the queue.
      Parameters:
      queueEntryTime - the time in milliseconds as a long value.
    • addChannel

      public void addChannel(org.jppf.execute.ExecutorChannel<?> channel)
      Add a channel to this job.
      Parameters:
      channel - the channel to add.
    • removeChannel

      public void removeChannel(org.jppf.execute.ExecutorChannel<?> channel)
      Add a channel to this job.
      Parameters:
      channel - the channel to add.
    • acceptsChannel

      public boolean acceptsChannel(org.jppf.execute.ExecutorChannel<?> channel)
      Determine whether this job can be sent to the specified channel. Currently this method only accepts a single remote channel, and it has to always be the same for the same job. See #remoteChannel.
      Parameters:
      channel - the channel to check for acceptance.
      Returns:
      true if the channel is accepted, false otherwise.
    • preparePolicy

      public void preparePolicy(org.jppf.node.policy.ExecutionPolicy policy)
      Set the parameters needed as bounded variables fro scripted execution policies.
      Parameters:
      policy - the root policy to explore.
    • clearChannels

      public void clearChannels()
      Clear the channels used to dispatch this job.
    • isCancelling

      public boolean isCancelling()
      Whether this job is being cancelled.
      Returns:
      true a cancellation request is being processed, false otherwise.
    • isCancellingOrCancelled

      public boolean isCancellingOrCancelled()
      Whether this job is being cancelled or has already been cancelled.
      Returns:
      true a cancellation request is being or has been processed, false otherwise.