类 StepExecution
- java.lang.Object
- org.springframework.batch.core.Entity
- org.springframework.batch.core.StepExecution
- 所有已实现的接口:
java.io.Serializable
public class StepExecution extends Entity
Batch domain object representation the execution of a step. UnlikeJobExecution
, there are additional properties related the processing of items such as commit count, etc.- 作者:
- Lucas Ward, Dave Syer
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 StepExecution(java.lang.String stepName, JobExecution jobExecution)
Constructor that substitutes in null for the execution idStepExecution(java.lang.String stepName, JobExecution jobExecution, java.lang.Long id)
Constructor with mandatory properties.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addFailureException(java.lang.Throwable throwable)
void
apply(StepContribution contribution)
On successful execution just before a chunk commit, this method should be called.StepContribution
createStepContribution()
Factory method forStepContribution
.boolean
equals(java.lang.Object obj)
Attempt to establish identity based on id if both exist.int
getCommitCount()
Returns the current number of commits for this executionjava.util.Date
getEndTime()
Returns the time that this execution endedExecutionContext
getExecutionContext()
Returns theExecutionContext
for this executionExitStatus
getExitStatus()
java.util.List<java.lang.Throwable>
getFailureExceptions()
int
getFilterCount()
Returns the current number of items filtered out of this executionJobExecution
getJobExecution()
Accessor for the execution context information of the enclosing job.java.lang.Long
getJobExecutionId()
Accessor for the job execution id.JobParameters
getJobParameters()
Convenience method to get the current job parameters.java.util.Date
getLastUpdated()
int
getProcessSkipCount()
int
getReadCount()
Returns the current number of items read for this executionint
getReadSkipCount()
int
getRollbackCount()
Returns the current number of rollbacks for this executionint
getSkipCount()
java.util.Date
getStartTime()
Gets the time this execution startedBatchStatus
getStatus()
Returns the current status of this stepjava.lang.String
getStepName()
java.lang.String
getSummary()
int
getWriteCount()
Returns the current number of items written for this executionint
getWriteSkipCount()
int
hashCode()
Use ID if it exists to establish hash code, otherwise fall back to Object.hashCode().void
incrementCommitCount()
Increment the number of commitsvoid
incrementRollbackCount()
On unsuccessful execution after a chunk has rolled back.boolean
isTerminateOnly()
void
setCommitCount(int commitCount)
Sets the current number of commits for this executionvoid
setEndTime(java.util.Date endTime)
Sets the time that this execution endedvoid
setExecutionContext(ExecutionContext executionContext)
Sets theExecutionContext
for this executionvoid
setExitStatus(ExitStatus exitStatus)
void
setFilterCount(int filterCount)
Public setter for the number of items filtered out of this execution.void
setLastUpdated(java.util.Date lastUpdated)
Set the time when the StepExecution was last updated before persistingvoid
setProcessSkipCount(int processSkipCount)
Set the number of records skipped during processing.void
setReadCount(int readCount)
Sets the current number of read items for this executionvoid
setReadSkipCount(int readSkipCount)
Set the number of records skipped on readvoid
setRollbackCount(int rollbackCount)
Setter for number of rollbacks for this executionvoid
setStartTime(java.util.Date startTime)
Sets the time this execution startedvoid
setStatus(BatchStatus status)
Sets the current status of this stepvoid
setTerminateOnly()
Set a flag that will signal to an execution environment that this execution (and its surrounding job) wishes to exit.void
setWriteCount(int writeCount)
Sets the current number of written items for this executionvoid
setWriteSkipCount(int writeSkipCount)
Set the number of records skipped on writejava.lang.String
toString()
void
upgradeStatus(BatchStatus status)
Upgrade the status field if the provided value is greater than the existing one.从类继承的方法 org.springframework.batch.core.Entity
getId, getVersion, incrementVersion, setId, setVersion
构造器详细资料
StepExecution
public StepExecution(java.lang.String stepName, JobExecution jobExecution, java.lang.Long id)
Constructor with mandatory properties.- 参数:
stepName
- the step to which this execution belongsjobExecution
- the current job executionid
- the id of this execution
StepExecution
public StepExecution(java.lang.String stepName, JobExecution jobExecution)
Constructor that substitutes in null for the execution id- 参数:
stepName
- the step to which this execution belongsjobExecution
- the current job execution
方法详细资料
getExecutionContext
public ExecutionContext getExecutionContext()
Returns theExecutionContext
for this execution- 返回:
- the attributes
setExecutionContext
public void setExecutionContext(ExecutionContext executionContext)
Sets theExecutionContext
for this execution- 参数:
executionContext
- the attributes
getCommitCount
public int getCommitCount()
Returns the current number of commits for this execution- 返回:
- the current number of commits
setCommitCount
public void setCommitCount(int commitCount)
Sets the current number of commits for this execution- 参数:
commitCount
- the current number of commits
getEndTime
public java.util.Date getEndTime()
Returns the time that this execution ended- 返回:
- the time that this execution ended
setEndTime
public void setEndTime(java.util.Date endTime)
Sets the time that this execution ended- 参数:
endTime
- the time that this execution ended
getReadCount
public int getReadCount()
Returns the current number of items read for this execution- 返回:
- the current number of items read for this execution
setReadCount
public void setReadCount(int readCount)
Sets the current number of read items for this execution- 参数:
readCount
- the current number of read items for this execution
getWriteCount
public int getWriteCount()
Returns the current number of items written for this execution- 返回:
- the current number of items written for this execution
setWriteCount
public void setWriteCount(int writeCount)
Sets the current number of written items for this execution- 参数:
writeCount
- the current number of written items for this execution
getRollbackCount
public int getRollbackCount()
Returns the current number of rollbacks for this execution- 返回:
- the current number of rollbacks for this execution
getFilterCount
public int getFilterCount()
Returns the current number of items filtered out of this execution- 返回:
- the current number of items filtered out of this execution
setFilterCount
public void setFilterCount(int filterCount)
Public setter for the number of items filtered out of this execution.- 参数:
filterCount
- the number of items filtered out of this execution to set
setRollbackCount
public void setRollbackCount(int rollbackCount)
Setter for number of rollbacks for this execution- 参数:
rollbackCount
- int the number of rollbacks.
getStartTime
public java.util.Date getStartTime()
Gets the time this execution started- 返回:
- the time this execution started
setStartTime
public void setStartTime(java.util.Date startTime)
Sets the time this execution started- 参数:
startTime
- the time this execution started
getStatus
public BatchStatus getStatus()
Returns the current status of this step- 返回:
- the current status of this step
setStatus
public void setStatus(BatchStatus status)
Sets the current status of this step- 参数:
status
- the current status of this step
upgradeStatus
public void upgradeStatus(BatchStatus status)
Upgrade the status field if the provided value is greater than the existing one. Clients using this method to set the status can be sure that they don't overwrite a failed status with an successful one.- 参数:
status
- the new status value
getStepName
public java.lang.String getStepName()
- 返回:
- the name of the step
getJobExecutionId
public java.lang.Long getJobExecutionId()
Accessor for the job execution id.- 返回:
- the jobExecutionId
setExitStatus
public void setExitStatus(ExitStatus exitStatus)
- 参数:
exitStatus
-ExitStatus
instance used to establish the exit status.
getExitStatus
public ExitStatus getExitStatus()
- 返回:
- the exitCode
getJobExecution
public JobExecution getJobExecution()
Accessor for the execution context information of the enclosing job.- 返回:
- the
JobExecution
that was used to start this step execution.
createStepContribution
public StepContribution createStepContribution()
Factory method forStepContribution
.- 返回:
- a new
StepContribution
apply
public void apply(StepContribution contribution)
On successful execution just before a chunk commit, this method should be called. Synchronizes access to theStepExecution
so that changes are atomic.- 参数:
contribution
-StepContribution
instance used to update the StepExecution state.
incrementRollbackCount
public void incrementRollbackCount()
On unsuccessful execution after a chunk has rolled back.
isTerminateOnly
public boolean isTerminateOnly()
- 返回:
- flag to indicate that an execution should halt
setTerminateOnly
public void setTerminateOnly()
Set a flag that will signal to an execution environment that this execution (and its surrounding job) wishes to exit.
getSkipCount
public int getSkipCount()
- 返回:
- the total number of items skipped.
incrementCommitCount
public void incrementCommitCount()
Increment the number of commits
getJobParameters
public JobParameters getJobParameters()
Convenience method to get the current job parameters.- 返回:
- the
JobParameters
from the enclosing job, or empty if that is null
getReadSkipCount
public int getReadSkipCount()
- 返回:
- the number of records skipped on read
getWriteSkipCount
public int getWriteSkipCount()
- 返回:
- the number of records skipped on write
setReadSkipCount
public void setReadSkipCount(int readSkipCount)
Set the number of records skipped on read- 参数:
readSkipCount
- int containing read skip count to be used for the step execution.
setWriteSkipCount
public void setWriteSkipCount(int writeSkipCount)
Set the number of records skipped on write- 参数:
writeSkipCount
- int containing write skip count to be used for the step execution.
getProcessSkipCount
public int getProcessSkipCount()
- 返回:
- the number of records skipped during processing
setProcessSkipCount
public void setProcessSkipCount(int processSkipCount)
Set the number of records skipped during processing.- 参数:
processSkipCount
- int containing process skip count to be used for the step execution.
getLastUpdated
public java.util.Date getLastUpdated()
- 返回:
- the Date representing the last time this execution was persisted.
setLastUpdated
public void setLastUpdated(java.util.Date lastUpdated)
Set the time when the StepExecution was last updated before persisting- 参数:
lastUpdated
-Date
instance used to establish the last updated date for the Step Execution.
getFailureExceptions
public java.util.List<java.lang.Throwable> getFailureExceptions()
addFailureException
public void addFailureException(java.lang.Throwable throwable)
equals
public boolean equals(java.lang.Object obj)
从类复制的说明:Entity
Attempt to establish identity based on id if both exist. If either id does not exist use Object.equals().
hashCode
public int hashCode()
从类复制的说明:Entity
Use ID if it exists to establish hash code, otherwise fall back to Object.hashCode(). Based on the same information as equals, so if that changes, this will. N.B. this follows the contract of Object.hashCode(), but will cause problems for anyone adding an unsavedEntity
to a Set because Set.contains() will almost certainly return false for theEntity
after it is saved. Spring Batch does not store any of its entities in Sets as a matter of course, so internally this is consistent. Clients should not be exposed to unsaved entities.
getSummary
public java.lang.String getSummary()