com.sap.scheduler.runtime

Class Job

java.lang.Object
  extended by com.sap.scheduler.runtime.Job
All Implemented Interfaces:
Serializable, Comparable<Job>

public class Job
extends Object
implements Serializable, Comparable<Job>

This object represents a job. A job is an instance of a job definition and runs once. It is considered a new job if the job is restarted.

See Also:
Serialized Form

Constructor Summary
Job()
          Deprecated. Please use Job(JobID, JobDefinitionID, SchedulerID, String, JobStatus, Date, Date, Date, String, short, String, JobID, String, boolean, int, SchedulerTaskID) instead
Job(JobID id, JobDefinitionID defID, SchedulerID schedID, String name, JobStatus status, Date startDate, Date endDate, Date submitTime, String node, short returnCode, String userID, JobID parent, String vendorData, boolean cancelRequest, int retentionPeriod)
          Deprecated. Please use Job(JobID, JobDefinitionID, SchedulerID, String, JobStatus, Date, Date, Date, String, short, String, JobID, String, boolean, int, SchedulerTaskID) instead
Job(JobID id, JobDefinitionID defID, SchedulerID schedID, String name, JobStatus status, Date startDate, Date endDate, Date submitTime, String node, short returnCode, String userID, JobID parent, String vendorData, boolean cancelRequest, int retentionPeriod, SchedulerTaskID schedTaskID)
          Create a new job object from the parameters provided.
Job(JobID id, JobDefinitionID defID, SchedulerID schedID, String name, JobStatus status, Date startDate, Date endDate, Date submitTime, String node, short returnCode, String userID, JobID parent, String vendorData, boolean cancelRequest, int retentionPeriod, SchedulerTaskID schedTaskID, long cpuTime, long memoryAllocation)
          Create a new job object from the parameters provided.
 
Method Summary
protected static int compareEndDates(Job j1, Job j2)
          Compares end dates of 2 jobs
protected static int compareIds(Job j1, Job j2)
          Compares id of 2 jobs according to parameter asc
 int compareTo(Job otherJob)
          Compare the current job with the job otherJob
The comparison is doing first by end date(asc), then by id (ascending)
 boolean getCancelRequest()
           
 long getCPUTime()
          Returns the CPU time required to run this job.
 Date getEndDate()
          Returns the date when this job finished
 JobID getId()
          Get the job id (unique identifier).
 JobDefinitionID getJobDefinitionId()
           
 JobStatus getJobStatus()
          Get the status.
 long getMemoryAllocation()
          Returns the overall memory allocated by this job.
 String getName()
          Get the name of the job definition.
 String getNode()
          Get the node which executes or has execute this job
 JobID getParent()
          Get the parent job, or null if it has no parent.
 int getRetentionPeriod()
           
 short getReturnCode()
          Get the return code of this job.
 SchedulerID getScheduler()
           
 SchedulerTaskID getSchedulerTaskId()
           
 Date getStartDate()
          Returns the start date of this job.
 Date getSubmitDate()
          date when this job was submitted
 String getUser()
          User id which is used to run this job
 String getVendorData()
           
 void setCancelRequest(boolean value)
          Deprecated. use the constructor
 void setEndDate(Date end)
          Deprecated. use the constructor
 void setId(JobID id)
          Deprecated. use the constructor
 void setJobDefinitionId(JobDefinitionID id)
          Deprecated. use the constructor
 void setJobStatus(JobStatus jobStatus)
          Deprecated. use the constructor
 void setName(String name)
          Deprecated. use the constructor
 void setNode(String node)
          Deprecated. use the constructor
 void setParent(JobID parent)
          Deprecated. use the constructor
 void setReturnCode(short returnCode)
          Deprecated. use the constructor
 void setScheduler(SchedulerID scheduler)
          Deprecated. use the constructor
 void setStartDate(Date startDate)
          Deprecated. use the constructor
 void setSubmitDate(Date date)
          Deprecated. use the constructor
 void setUser(String userId)
          Deprecated. use the constructor
 void setVendorData(String value)
          Deprecated. use the constructor
 String toFormattedString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Job

public Job(JobID id,
           JobDefinitionID defID,
           SchedulerID schedID,
           String name,
           JobStatus status,
           Date startDate,
           Date endDate,
           Date submitTime,
           String node,
           short returnCode,
           String userID,
           JobID parent,
           String vendorData,
           boolean cancelRequest,
           int retentionPeriod)
Deprecated. Please use Job(JobID, JobDefinitionID, SchedulerID, String, JobStatus, Date, Date, Date, String, short, String, JobID, String, boolean, int, SchedulerTaskID) instead

Parameters:
id -
defID -
schedID -
name -
status -
startDate -
endDate -
submitTime -
node -
returnCode -
userID -
parent -
vendorData -
cancelRequest -
retentionPeriod -

Job

public Job(JobID id,
           JobDefinitionID defID,
           SchedulerID schedID,
           String name,
           JobStatus status,
           Date startDate,
           Date endDate,
           Date submitTime,
           String node,
           short returnCode,
           String userID,
           JobID parent,
           String vendorData,
           boolean cancelRequest,
           int retentionPeriod,
           SchedulerTaskID schedTaskID)
Create a new job object from the parameters provided.

Parameters:
id - id of the job
defID - id of the job definition
schedID - id of the scheduler that triggered this job
name - name of this job
status - current status of the job
startDate - date when the job was started
endDate - date when the job ended
submitTime - date when the job was submitted
node - node where this job is running
returnCode - return code of the job
userID - user which was used to run this job
parent - parent job (if any)
vendorData - vendor specific data
cancelRequest - indicates whether there is a cancel request for this job
retentionPeriod - time this record will be kept after the job has ended
schedTaskID - task id from which this job was scheduled

Job

public Job(JobID id,
           JobDefinitionID defID,
           SchedulerID schedID,
           String name,
           JobStatus status,
           Date startDate,
           Date endDate,
           Date submitTime,
           String node,
           short returnCode,
           String userID,
           JobID parent,
           String vendorData,
           boolean cancelRequest,
           int retentionPeriod,
           SchedulerTaskID schedTaskID,
           long cpuTime,
           long memoryAllocation)
Create a new job object from the parameters provided.

Parameters:
id - id of the job
defID - id of the job definition
schedID - id of the scheduler that triggered this job
name - name of this job
status - current status of the job
startDate - date when the job was started
endDate - date when the job ended
submitTime - date when the job was submitted
node - node where this job is running
returnCode - return code of the job
userID - user which was used to run this job
parent - parent job (if any)
vendorData - vendor specific data
cancelRequest - indicates whether there is a cancel request for this job
retentionPeriod - time this record will be kept after the job has ended
schedTaskID - task id from which this job was scheduled
cpuTime - CPU time for this job
memoryAllocation - memory allocated by this job

Job

public Job()
Deprecated. Please use Job(JobID, JobDefinitionID, SchedulerID, String, JobStatus, Date, Date, Date, String, short, String, JobID, String, boolean, int, SchedulerTaskID) instead

Method Detail

getId

public JobID getId()
Get the job id (unique identifier).

Returns:
the job id.

setId

public void setId(JobID id)
Deprecated. use the constructor

Parameters:
id -

getJobStatus

public JobStatus getJobStatus()
Get the status.

Returns:
the status code.

setJobStatus

public void setJobStatus(JobStatus jobStatus)
Deprecated. use the constructor

Parameters:
jobStatus -

getNode

public String getNode()
Get the node which executes or has execute this job

Returns:
Node or null if this job has not been executed

setNode

public void setNode(String node)
Deprecated. use the constructor

Parameters:
node -

getParent

public JobID getParent()
Get the parent job, or null if it has no parent.

Returns:
the parent job.

setParent

public void setParent(JobID parent)
Deprecated. use the constructor

Parameters:
parent -

getReturnCode

public short getReturnCode()
Get the return code of this job.

Returns:
the return code.

setReturnCode

public void setReturnCode(short returnCode)
Deprecated. use the constructor

Parameters:
returnCode -

getScheduler

public SchedulerID getScheduler()
Returns:
the name of the scheduler which controls this job.

setScheduler

public void setScheduler(SchedulerID scheduler)
Deprecated. use the constructor

Parameters:
scheduler -

getStartDate

public Date getStartDate()
Returns the start date of this job.

Returns:
the date when this job was started or null if it has not been started

setStartDate

public void setStartDate(Date startDate)
Deprecated. use the constructor

Parameters:
startDate -

getEndDate

public Date getEndDate()
Returns the date when this job finished

Returns:
date when this job is finished of null if it has not finished

setEndDate

public void setEndDate(Date end)
Deprecated. use the constructor

Parameters:
end -

getSubmitDate

public Date getSubmitDate()
date when this job was submitted

Returns:
a Date object representing the time when this job was submitted

setSubmitDate

public void setSubmitDate(Date date)
Deprecated. use the constructor

Parameters:
date -

getUser

public String getUser()
User id which is used to run this job

Returns:
user id

setUser

public void setUser(String userId)
Deprecated. use the constructor

Parameters:
userId -

getJobDefinitionId

public JobDefinitionID getJobDefinitionId()
Returns:
Job Definition ID

setJobDefinitionId

public void setJobDefinitionId(JobDefinitionID id)
Deprecated. use the constructor

Parameters:
id -

getName

public String getName()
Get the name of the job definition.

Returns:
the job name.

setName

public void setName(String name)
Deprecated. use the constructor

Parameters:
name -

getVendorData

public String getVendorData()
Returns:
vendor data

setVendorData

public void setVendorData(String value)
Deprecated. use the constructor

Parameters:
value -

setCancelRequest

public void setCancelRequest(boolean value)
Deprecated. use the constructor

Parameters:
value -

getCancelRequest

public boolean getCancelRequest()
Returns:
cancelled request

getRetentionPeriod

public int getRetentionPeriod()
Returns:
retention period

getSchedulerTaskId

public SchedulerTaskID getSchedulerTaskId()
Returns:
scheduler task ID

getCPUTime

public long getCPUTime()
Returns the CPU time required to run this job. It is 0 if the job has not finished.

Returns:
CPU time in microseconds

getMemoryAllocation

public long getMemoryAllocation()
Returns the overall memory allocated by this job. Memory freed by the garbage collector is not considered.

Returns:
memory allocated by the job in bytes

toFormattedString

public String toFormattedString()
Returns:
formatted strings

compareTo

public int compareTo(Job otherJob)
Compare the current job with the job otherJob
The comparison is doing first by end date(asc), then by id (ascending)

Specified by:
compareTo in interface Comparable<Job>

compareIds

protected static int compareIds(Job j1,
                                Job j2)
Compares id of 2 jobs according to parameter asc

Parameters:
j1 - First Job
j2 - Second Job
asc - true for ascending, false for descending order (the order is applied only on Job IDs)
Returns:
comparison of jobs

compareEndDates

protected static int compareEndDates(Job j1,
                                     Job j2)
Compares end dates of 2 jobs

Parameters:
j1 - First Job
j2 - Second Job
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] ENGFACADE [sap.com] tc/je/scheduler/api api BC-JAS


Copyright 2014 SAP AG Complete Copyright Notice