public class JobExecution extends Entity
Constructor and Description |
---|
JobExecution(JobExecution original) |
JobExecution(JobInstance job,
JobParameters jobParameters)
Constructor for transient (unsaved) instances.
|
JobExecution(JobInstance job,
JobParameters jobParameters,
java.lang.String jobConfigurationName) |
JobExecution(JobInstance job,
java.lang.Long id,
JobParameters jobParameters,
java.lang.String jobConfigurationName)
Because a JobExecution isn't valid unless the job is set, this
constructor is the only valid one from a modeling point of view.
|
JobExecution(java.lang.Long id) |
JobExecution(java.lang.Long id,
JobParameters jobParameters) |
JobExecution(java.lang.Long id,
JobParameters jobParameters,
java.lang.String jobConfigurationName) |
Modifier and Type | Method and Description |
---|---|
void |
addFailureException(java.lang.Throwable t)
Add the provided throwable to the failure exception list.
|
void |
addStepExecutions(java.util.List<StepExecution> stepExecutions)
Add some step executions.
|
StepExecution |
createStepExecution(java.lang.String stepName)
Register a step execution with the current job execution.
|
java.util.List<java.lang.Throwable> |
getAllFailureExceptions()
Return all failure causing exceptions for this JobExecution, including
step executions.
|
java.util.Date |
getCreateTime() |
java.util.Date |
getEndTime() |
ExecutionContext |
getExecutionContext()
Returns the
ExecutionContext for this execution. |
ExitStatus |
getExitStatus() |
java.util.List<java.lang.Throwable> |
getFailureExceptions() |
java.lang.String |
getJobConfigurationName() |
java.lang.Long |
getJobId()
Convenience getter for for the id of the enclosing job.
|
JobInstance |
getJobInstance() |
JobParameters |
getJobParameters() |
java.util.Date |
getLastUpdated()
Get the date representing the last time this JobExecution was updated in
the JobRepository.
|
java.util.Date |
getStartTime() |
BatchStatus |
getStatus() |
java.util.Collection<StepExecution> |
getStepExecutions()
Accessor for the step executions.
|
boolean |
isRunning()
Test if this
JobExecution indicates that it is running. |
boolean |
isStopping()
Test if this
JobExecution indicates that it has been signalled to
stop. |
void |
setCreateTime(java.util.Date createTime) |
void |
setEndTime(java.util.Date endTime) |
void |
setExecutionContext(ExecutionContext executionContext)
Sets the
ExecutionContext for this execution |
void |
setExitStatus(ExitStatus exitStatus) |
void |
setJobInstance(JobInstance jobInstance) |
void |
setLastUpdated(java.util.Date lastUpdated)
Set the last time this JobExecution was updated.
|
void |
setStartTime(java.util.Date startTime) |
void |
setStatus(BatchStatus status)
Set the value of the status field.
|
void |
stop()
Deprecated.
Use
JobOperator.stop(long)
or CommandLineJobRunner
with the "-stop" option instead. |
java.lang.String |
toString() |
void |
upgradeStatus(BatchStatus status)
Upgrade the status field if the provided value is greater than the
existing one.
|
equals, getId, getVersion, hashCode, incrementVersion, setId, setVersion
public JobExecution(JobExecution original)
public JobExecution(JobInstance job, java.lang.Long id, @Nullable JobParameters jobParameters, java.lang.String jobConfigurationName)
job
- the job of which this execution is a partid
- Long
that represents the id for the JobExecution.jobParameters
- JobParameters
instance for this JobExecution.jobConfigurationName
- String
instance that represents the
job configuration name (used with JSR-352).public JobExecution(JobInstance job, JobParameters jobParameters, java.lang.String jobConfigurationName)
public JobExecution(java.lang.Long id, JobParameters jobParameters, java.lang.String jobConfigurationName)
public JobExecution(JobInstance job, JobParameters jobParameters)
job
- the enclosing JobInstance
jobParameters
- JobParameters
instance for this JobExecution.public JobExecution(java.lang.Long id, JobParameters jobParameters)
public JobExecution(java.lang.Long id)
public JobParameters getJobParameters()
@Nullable public java.util.Date getEndTime()
public void setJobInstance(JobInstance jobInstance)
public void setEndTime(java.util.Date endTime)
@Nullable public java.util.Date getStartTime()
public void setStartTime(java.util.Date startTime)
public BatchStatus getStatus()
public void setStatus(BatchStatus status)
status
- the status to setpublic void upgradeStatus(BatchStatus status)
status
- the new status valuepublic java.lang.Long getJobId()
public void setExitStatus(ExitStatus exitStatus)
exitStatus
- ExitStatus
instance to be used for job execution.public ExitStatus getExitStatus()
public JobInstance getJobInstance()
public java.util.Collection<StepExecution> getStepExecutions()
public StepExecution createStepExecution(java.lang.String stepName)
stepName
- the name of the step the new execution is associated withStepExecution
an empty StepExecution
associated with this
JobExecution
.public boolean isRunning()
JobExecution
indicates that it is running. It should
be noted that this does not necessarily mean that it has been persisted
as such yet.public boolean isStopping()
JobExecution
indicates that it has been signalled to
stop.BatchStatus.STOPPING
@Deprecated public void stop()
JobOperator.stop(long)
or CommandLineJobRunner
with the "-stop" option instead.JobExecution
to stop. Iterates through the associated
StepExecution
s, calling StepExecution.setTerminateOnly()
.public void setExecutionContext(ExecutionContext executionContext)
ExecutionContext
for this executionexecutionContext
- the contextpublic ExecutionContext getExecutionContext()
ExecutionContext
for this execution. The content is
expected to be persisted after each step completion (successful or not).public java.util.Date getCreateTime()
public void setCreateTime(java.util.Date createTime)
createTime
- creation time of this execution.public java.lang.String getJobConfigurationName()
@Nullable public java.util.Date getLastUpdated()
public void setLastUpdated(java.util.Date lastUpdated)
lastUpdated
- Date
instance to mark job execution's lastUpdated attribute.public java.util.List<java.lang.Throwable> getFailureExceptions()
public void addFailureException(java.lang.Throwable t)
t
- Throwable
instance to be added failure exception list.public java.util.List<java.lang.Throwable> getAllFailureExceptions()
public void addStepExecutions(java.util.List<StepExecution> stepExecutions)
stepExecutions
- step executions to add to the current list