Class CompositeCompletionPolicy
java.lang.Object
org.springframework.batch.repeat.policy.CompositeCompletionPolicy
- All Implemented Interfaces:
CompletionPolicy
Composite policy that loops through a list of delegate policies and answers calls by a
consensus.
- Author:
- Dave Syer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classComposite context that knows about the policies and contexts is was created with. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisComplete(RepeatContext context) This policy is complete if any of the composed policies is complete.booleanisComplete(RepeatContext context, RepeatStatus result) This policy is complete if any of the composed policies is complete.voidsetPolicies(CompletionPolicy[] policies) Setter for the policies.start(RepeatContext context) Create a new composite context from all the available policies.voidupdate(RepeatContext context) Update all the composed contexts, and also increment the parent context.
-
Constructor Details
-
CompositeCompletionPolicy
public CompositeCompletionPolicy()
-
-
Method Details
-
setPolicies
Setter for the policies.- Parameters:
policies- an array of completion policies to be used to determineisComplete(RepeatContext)by consensus.
-
isComplete
This policy is complete if any of the composed policies is complete.- Specified by:
isCompletein interfaceCompletionPolicy- Parameters:
context- the current batch context.result- the result of the latest batch item processing.- Returns:
- true if the batch should terminate.
- See Also:
-
isComplete
This policy is complete if any of the composed policies is complete.- Specified by:
isCompletein interfaceCompletionPolicy- Parameters:
context- the current batch context.- Returns:
- true if the batch should terminate.
- See Also:
-
start
Create a new composite context from all the available policies.- Specified by:
startin interfaceCompletionPolicy- Parameters:
context- the current context if one is already in progress.- Returns:
- a context object that can be used by the implementation to store internal state for a batch.
- See Also:
-
update
Update all the composed contexts, and also increment the parent context.- Specified by:
updatein interfaceCompletionPolicy- Parameters:
context- the value returned by start.- See Also:
-