public abstract class CountingCompletionPolicy extends DefaultResultCompletionPolicy
Modifier and Type | Class and Description |
---|---|
protected class |
CountingCompletionPolicy.CountingBatchContext |
Modifier and Type | Field and Description |
---|---|
static String |
COUNT
Session key for global counter.
|
Constructor and Description |
---|
CountingCompletionPolicy() |
Modifier and Type | Method and Description |
---|---|
protected int |
doUpdate(RepeatContext context)
Extension point for subclasses.
|
protected abstract int |
getCount(RepeatContext context)
Extension point for subclasses.
|
boolean |
isComplete(RepeatContext context)
Always false.
|
void |
setMaxCount(int maxCount)
Setter for maximum value of count before termination.
|
void |
setUseParent(boolean useParent)
Flag to indicate whether the count is at the level of the parent context,
or just local to the context.
|
RepeatContext |
start(RepeatContext parent)
Build a new
RepeatContextSupport and return it. |
void |
update(RepeatContext context)
Increment the context so the counter is up to date.
|
isComplete
public static final String COUNT
public void setUseParent(boolean useParent)
useParent
- whether to use the parent context to cache the total
count. Default value is false.public void setMaxCount(int maxCount)
maxCount
- the maximum number of counts before termination. Default
0 so termination is immediate.protected abstract int getCount(RepeatContext context)
context
- the current context, specific to the subclass.protected int doUpdate(RepeatContext context)
setUseParent(boolean)
is true.context
- the current context.public final boolean isComplete(RepeatContext context)
DefaultResultCompletionPolicy
isComplete
in interface CompletionPolicy
isComplete
in class DefaultResultCompletionPolicy
context
- the current batch context.CompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext)
public RepeatContext start(RepeatContext parent)
CompletionPolicySupport
RepeatContextSupport
and return it.start
in interface CompletionPolicy
start
in class CompletionPolicySupport
parent
- the current context if one is already in progress.CompletionPolicy.start(RepeatContext)
public final void update(RepeatContext context)
CompletionPolicySupport
update
in interface CompletionPolicy
update
in class CompletionPolicySupport
context
- the value returned by start.CompletionPolicy.update(org.springframework.batch.repeat.RepeatContext)
Copyright © 2014 Pivotal. All rights reserved.