|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.repeat.context.RepeatContextCounter
public class RepeatContextCounter
Helper class for policies that need to count the number of occurrences of some event (e.g. an exception type in the context) in the scope of a batch. The value of the counter can be stored between batches in a nested context, so that the termination decision is based on the aggregate of a number of sibling batches.
| Constructor Summary | |
|---|---|
RepeatContextCounter(RepeatContext context,
java.lang.String countKey)
Convenience constructor with useParent=false. |
|
RepeatContextCounter(RepeatContext context,
java.lang.String countKey,
boolean useParent)
Construct a new RepeatContextCounter. |
|
| Method Summary | |
|---|---|
int |
getCount()
|
void |
increment()
Increment by 1. |
void |
increment(int delta)
Increment the counter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RepeatContextCounter(RepeatContext context,
java.lang.String countKey)
context - the current context.countKey - the key to use to store the counter in the context.
public RepeatContextCounter(RepeatContext context,
java.lang.String countKey,
boolean useParent)
RepeatContextCounter.
context - the current context.countKey - the key to use to store the counter in the context.useParent - true if the counter is to be shared between siblings.
The state will be stored in the parent of the context (if it exists)
instead of the context itself.| Method Detail |
|---|
public final void increment(int delta)
delta - the amount by which to increment the counter.public final void increment()
public int getCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||