类 StepExecutionSimpleCompletionPolicy
- java.lang.Object
- org.springframework.batch.core.listener.StepExecutionListenerSupport
- org.springframework.batch.core.resource.StepExecutionSimpleCompletionPolicy
- 所有已实现的接口:
StepExecutionListener
,StepListener
,CompletionPolicy
public class StepExecutionSimpleCompletionPolicy extends StepExecutionListenerSupport implements CompletionPolicy
A
CompletionPolicy
that picks up a commit interval fromJobParameters
by listening to the start of a step. Use anywhere that aCompletionPolicy
can be used (usually at the chunk level in a step), and inject as aStepExecutionListener
into the surrounding step. N.B. only after the step has started will the completion policy be usable.It is easier and probably preferable to simply declare the chunk with a commit-interval that is a late-binding expression (e.g.
#{jobParameters['commit.interval']}
). That feature is available from of Spring Batch 2.1.7.- 作者:
- Dave Syer
- 另请参阅:
CompletionPolicy
构造器概要
构造器 构造器 说明 StepExecutionSimpleCompletionPolicy()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
beforeStep(StepExecution stepExecution)
Set up aSimpleCompletionPolicy
with a commit interval taken from theJobParameters
.boolean
isComplete(RepeatContext context)
Allow policy to signal completion according to internal state, without having to wait for the callback to complete.boolean
isComplete(RepeatContext context, RepeatStatus result)
Determine whether a batch is complete given the latest result from the callback.void
setKeyName(java.lang.String keyName)
Public setter for the key name of a Long value in theJobParameters
that will contain a commit interval.RepeatContext
start(RepeatContext parent)
Create a new context for the execution of a batch.java.lang.String
toString()
Delegates to the wrappedCompletionPolicy
if set, otherwise returns the value ofsetKeyName(String)
.void
update(RepeatContext context)
Give implementations the opportunity to update the state of the current batch.从类继承的方法 org.springframework.batch.core.listener.StepExecutionListenerSupport
afterStep
构造器详细资料
StepExecutionSimpleCompletionPolicy
public StepExecutionSimpleCompletionPolicy()
方法详细资料
setKeyName
public void setKeyName(java.lang.String keyName)
Public setter for the key name of a Long value in theJobParameters
that will contain a commit interval. Defaults to "commit.interval".- 参数:
keyName
- the keyName to set
beforeStep
public void beforeStep(StepExecution stepExecution)
Set up aSimpleCompletionPolicy
with a commit interval taken from theJobParameters
. If there is a Long parameter with the given key name, the intValue of this parameter is used. If not an exception will be thrown.- 指定者:
beforeStep
在接口中StepExecutionListener
- 覆盖:
beforeStep
在类中StepExecutionListenerSupport
- 参数:
stepExecution
- instance ofStepExecution
.- 另请参阅:
StepExecutionListenerSupport.beforeStep(org.springframework.batch.core.StepExecution)
isComplete
public boolean isComplete(RepeatContext context, RepeatStatus result)
从接口复制的说明:CompletionPolicy
Determine whether a batch is complete given the latest result from the callback. If this method returns true thenCompletionPolicy.isComplete(RepeatContext)
should also (but not necessarily vice versa, since the answer here depends on the result).- 指定者:
isComplete
在接口中CompletionPolicy
- 参数:
context
- the current batch context.result
- the result of the latest batch item processing.- 返回:
- true if the commit interval has been reached or the result indicates completion
- 另请参阅:
CompletionPolicy.isComplete(RepeatContext, RepeatStatus)
isComplete
public boolean isComplete(RepeatContext context)
从接口复制的说明:CompletionPolicy
Allow policy to signal completion according to internal state, without having to wait for the callback to complete.- 指定者:
isComplete
在接口中CompletionPolicy
- 参数:
context
- the current batch context.- 返回:
- if the commit interval has been reached
- 另请参阅:
CompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext)
start
public RepeatContext start(RepeatContext parent)
从接口复制的说明:CompletionPolicy
Create a new context for the execution of a batch. N.B. implementations should not return the parent from this method - they must create a new context to meet the specific needs of the policy. The best way to do this might be to override an existing implementation and use theRepeatContext
to store state in its attributes.- 指定者:
start
在接口中CompletionPolicy
- 参数:
parent
- the current context if one is already in progress.- 返回:
- a new
RepeatContext
- 另请参阅:
CompletionPolicy.start(org.springframework.batch.repeat.RepeatContext)
update
public void update(RepeatContext context)
从接口复制的说明:CompletionPolicy
Give implementations the opportunity to update the state of the current batch. Will be called once per callback, after it has been launched, but not necessarily after it completes (if the batch is asynchronous).- 指定者:
update
在接口中CompletionPolicy
- 参数:
context
- the value returned by start.- 另请参阅:
CompletionPolicy.update(org.springframework.batch.repeat.RepeatContext)
toString
public java.lang.String toString()
Delegates to the wrappedCompletionPolicy
if set, otherwise returns the value ofsetKeyName(String)
.- 覆盖:
toString
在类中java.lang.Object