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, Mahmoud Ben Hassine
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Composite context that knows about the policies and contexts is was created with. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isComplete
(RepeatContext context) This policy is complete if any of the composed policies is complete.boolean
isComplete
(RepeatContext context, RepeatStatus result) This policy is complete if any of the composed policies is complete.void
setPolicies
(CompletionPolicy[] policies) Setter for the policies.start
(RepeatContext context) Create a new composite context from all the available policies.void
update
(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:
isComplete
in 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:
isComplete
in 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:
start
in 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:
update
in interfaceCompletionPolicy
- Parameters:
context
- the value returned by start.- See Also:
-