public class StepExecutionSimpleCompletionPolicy extends StepExecutionListenerSupport implements org.springframework.batch.repeat.CompletionPolicy
A CompletionPolicy that picks up a commit interval from
JobParameters by listening to the start of a step. Use anywhere that
a CompletionPolicy can be used (usually at the chunk level in a
step), and inject as a StepExecutionListener 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.
CompletionPolicy| Constructor and Description |
|---|
StepExecutionSimpleCompletionPolicy() |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeStep(StepExecution stepExecution)
Set up a
SimpleCompletionPolicy with a commit interval taken from
the JobParameters. |
boolean |
isComplete(org.springframework.batch.repeat.RepeatContext context) |
boolean |
isComplete(org.springframework.batch.repeat.RepeatContext context,
org.springframework.batch.repeat.RepeatStatus result) |
void |
setKeyName(java.lang.String keyName)
Public setter for the key name of a Long value in the
JobParameters that will contain a commit interval. |
org.springframework.batch.repeat.RepeatContext |
start(org.springframework.batch.repeat.RepeatContext parent) |
java.lang.String |
toString()
Delegates to the wrapped
CompletionPolicy if set, otherwise
returns the value of setKeyName(String). |
void |
update(org.springframework.batch.repeat.RepeatContext context) |
afterSteppublic void setKeyName(java.lang.String keyName)
JobParameters that will contain a commit interval. Defaults to
"commit.interval".keyName - the keyName to setpublic void beforeStep(StepExecution stepExecution)
SimpleCompletionPolicy with a commit interval taken from
the JobParameters. 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 in interface StepExecutionListenerbeforeStep in class StepExecutionListenerSupportstepExecution - instance of StepExecution.StepExecutionListenerSupport.beforeStep(org.springframework.batch.core.StepExecution)public boolean isComplete(org.springframework.batch.repeat.RepeatContext context,
org.springframework.batch.repeat.RepeatStatus result)
isComplete in interface org.springframework.batch.repeat.CompletionPolicyCompletionPolicy.isComplete(RepeatContext, RepeatStatus)public boolean isComplete(org.springframework.batch.repeat.RepeatContext context)
isComplete in interface org.springframework.batch.repeat.CompletionPolicyCompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext)public org.springframework.batch.repeat.RepeatContext start(org.springframework.batch.repeat.RepeatContext parent)
start in interface org.springframework.batch.repeat.CompletionPolicyRepeatContextCompletionPolicy.start(org.springframework.batch.repeat.RepeatContext)public void update(org.springframework.batch.repeat.RepeatContext context)
update in interface org.springframework.batch.repeat.CompletionPolicyCompletionPolicy.update(org.springframework.batch.repeat.RepeatContext)public java.lang.String toString()
CompletionPolicy if set, otherwise
returns the value of setKeyName(String).toString in class java.lang.Object