public class SimpleCompletionPolicy extends DefaultResultCompletionPolicy
RepeatTemplate
should ensure this contract is kept, but it needs
to be carefully monitored.Modifier and Type | Class and Description |
---|---|
protected class |
SimpleCompletionPolicy.SimpleTerminationContext |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CHUNK_SIZE |
Constructor and Description |
---|
SimpleCompletionPolicy() |
SimpleCompletionPolicy(int chunkSize) |
Modifier and Type | Method and Description |
---|---|
boolean |
isComplete(RepeatContext context)
Terminate if the chunk size has been reached.
|
boolean |
isComplete(RepeatContext context,
RepeatStatus result)
Terminate if the chunk size has been reached, or the result is null.
|
void |
setChunkSize(int chunkSize) |
RepeatContext |
start(RepeatContext context)
Reset the counter.
|
java.lang.String |
toString() |
void |
update(RepeatContext context)
Increment the counter in the context.
|
public static final int DEFAULT_CHUNK_SIZE
public SimpleCompletionPolicy()
public SimpleCompletionPolicy(int chunkSize)
public void setChunkSize(int chunkSize)
public RepeatContext start(RepeatContext context)
start
in interface CompletionPolicy
start
in class CompletionPolicySupport
context
- the current context if one is already in progress.CompletionPolicy.start(RepeatContext)
public boolean isComplete(RepeatContext context, RepeatStatus result)
isComplete
in interface CompletionPolicy
isComplete
in class DefaultResultCompletionPolicy
context
- the current batch context.result
- the result of the latest batch item processing.java.lang.RuntimeException
- (normally terminating the batch) if the result is
itself an exception.CompletionPolicy.isComplete(RepeatContext,
RepeatStatus)
public boolean isComplete(RepeatContext context)
isComplete
in interface CompletionPolicy
isComplete
in class DefaultResultCompletionPolicy
context
- the current batch context.CompletionPolicy.isComplete(RepeatContext)
public void update(RepeatContext context)
update
in interface CompletionPolicy
update
in class CompletionPolicySupport
context
- the value returned by start.CompletionPolicy.update(RepeatContext)
public java.lang.String toString()
toString
in class java.lang.Object