|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.listener.StepExecutionListenerSupport org.springframework.batch.core.resource.StepExecutionSimpleCompletionPolicy
public class StepExecutionSimpleCompletionPolicy
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.
CompletionPolicy
Constructor Summary | |
---|---|
StepExecutionSimpleCompletionPolicy()
|
Method Summary | |
---|---|
void |
beforeStep(StepExecution stepExecution)
Set up a SimpleCompletionPolicy with a commit interval taken from
the JobParameters . |
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(String keyName)
Public setter for the key name of a Long value in the JobParameters that will contain a commit interval. |
RepeatContext |
start(RepeatContext parent)
Create a new context for the execution of a batch. |
String |
toString()
Delegates to the wrapped CompletionPolicy if set, otherwise
returns the value of setKeyName(String) . |
void |
update(RepeatContext context)
Give implementations the opportunity to update the state of the current batch. |
Methods inherited from class org.springframework.batch.core.listener.StepExecutionListenerSupport |
---|
afterStep |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StepExecutionSimpleCompletionPolicy()
Method Detail |
---|
public void setKeyName(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 StepExecutionListener
beforeStep
in class StepExecutionListenerSupport
StepExecutionListenerSupport.beforeStep(org.springframework.batch.core.StepExecution)
public boolean isComplete(RepeatContext context, RepeatStatus result)
CompletionPolicy
CompletionPolicy.isComplete(RepeatContext)
should also (but not necessarily vice
versa, since the answer here depends on the result).
isComplete
in interface CompletionPolicy
context
- result
-
CompletionPolicy.isComplete(RepeatContext, RepeatStatus)
public boolean isComplete(RepeatContext context)
CompletionPolicy
isComplete
in interface CompletionPolicy
context
-
CompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext)
public RepeatContext start(RepeatContext parent)
CompletionPolicy
RepeatContext
to store state in its attributes.
start
in interface CompletionPolicy
parent
-
RepeatContext
CompletionPolicy.start(org.springframework.batch.repeat.RepeatContext)
public void update(RepeatContext context)
CompletionPolicy
update
in interface CompletionPolicy
context
- CompletionPolicy.update(org.springframework.batch.repeat.RepeatContext)
public String toString()
CompletionPolicy
if set, otherwise
returns the value of setKeyName(String)
.
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |