Interface Job

All Known Implementing Classes:
JobImpl

public interface Job
Represents a long running, asynchronous process. A Job may be used to track any task, whether it is queued to run in the future, currently running, or has run in the past.
  • Method Details

    • getId

      long getId()
      Gets the job identifier.
      Returns:
      the identifier
    • getCreator

      String getCreator()
      Gets the username of the subject responsible for creating the job initially. This job will execute with this user's roles and permissions.
      Returns:
      the username that created the job
    • setCreator

      void setCreator(String creator)
    • getOrganization

      String getOrganization()
      Returns the identifier of the organization that the creator is associated with.
      Returns:
      the organization
    • setOrganization

      void setOrganization(String organization)
    • getVersion

      long getVersion()
      Gets the version of this job. Each time the job is updated, the version number is incremented. If a process attempts to save a job that has been updated in another thread or on another host while the job was in memory, an optimistic locking exception will be thrown.
      Returns:
      the version number of this job
    • getJobType

      String getJobType()
      Gets the job type, which determines the type of service that runs the job.
      Returns:
      the job type
    • setJobType

      void setJobType(String jobType)
    • getOperation

      String getOperation()
      The operation type, which can be used by the service responsible for the job to determine the service method to execute.
      Returns:
      The operation
    • setOperation

      void setOperation(String operation)
    • getArguments

      List<String> getArguments()
      The arguments passed to the service and operation. Each argument must be serializable to a string.
      Returns:
      the arguments passed to the service operation
    • setArguments

      void setArguments(List<String> arguments)
    • getStatus

      Job.Status getStatus()
      Gets the receipt's current Job.Status
      Returns:
      the current status
    • setStatus

      void setStatus(Job.Status status)
    • setStatus

      void setStatus(Job.Status status, Job.FailureReason reason)
      Sets the receipt's current Job.Status along with the Job.FailureReason to indicate why - in the case of failure - the job failed.
      Parameters:
      status - the status to set
      reason - failure reason
    • getFailureReason

      Job.FailureReason getFailureReason()
      In the case of failure, returns whether the failure had to do with data or with processing. Depending on the reason, processing services might be marked not to accept new jobs.
      Returns:
      the failure reason
    • getCreatedHost

      String getCreatedHost()
      Gets the host that created this job.
      Returns:
      the server that originally created the job
    • getProcessingHost

      String getProcessingHost()
      Gets the host responsible for running this job.
      Returns:
      the server running the job, or null if the job hasn't yet started
    • setProcessingHost

      void setProcessingHost(String processingHost)
    • getDateCreated

      Date getDateCreated()
      The date this job was created.
      Returns:
      the date the job was created
    • setDateCreated

      void setDateCreated(Date created)
    • getDateStarted

      Date getDateStarted()
      The date this job was started. If the job was queued, this can be significantly later than the date created.
      Returns:
      the date the job was started
    • setDateStarted

      void setDateStarted(Date started)
    • getQueueTime

      Long getQueueTime()
      The number of milliseconds that this job has waited in a queue before execution. This value will be null if the job has not yet started execution.
      Returns:
      the total run time
    • setQueueTime

      void setQueueTime(Long queueTime)
    • getRunTime

      Long getRunTime()
      The number of milliseconds that this job took to execute. This value will be null if the job has not yet finished execution.
      Returns:
      the total run time
    • setRunTime

      void setRunTime(Long runTime)
    • getDateCompleted

      Date getDateCompleted()
      The date this job was completed
      Returns:
      the date completed
    • setDateCompleted

      void setDateCompleted(Date dateCompleted)
    • getPayload

      String getPayload()
      Gets the serialized output that was produced by this job, or null if nothing was produced, or if it has yet to be produced.
      Returns:
      the output of the job
    • setPayload

      void setPayload(String payload)
    • getSignature

      int getSignature()
      Returns:
    • getParentJobId

      Long getParentJobId()
      Gets the parent job identifier, or null if there is no parent.
      Returns:
      the parent identifier
    • setParentJobId

      void setParentJobId(Long parentJobId)
    • getRootJobId

      Long getRootJobId()
      Gets the root job identifier, or null if this is the root job.
      Returns:
      the root job identifier
    • isDispatchable

      boolean isDispatchable()
      Gets whether this job may be dispatched.
      Returns:
      whether the job can be queued for dispatch or not
    • setDispatchable

      void setDispatchable(boolean dispatchable)
    • getUri

      URI getUri()
      Gets the URI of this job, which can be used to check its status.
      Returns:
      the job's URI
    • getJobLoad

      Float getJobLoad()
      Gets the job's load. For example, a job which uses four cores would have a load of 4.0. This should be roughly the number of cores that this job occupies while running.
      Returns:
      the job's load
    • setJobLoad

      void setJobLoad(Float load)