接口 CompletionPolicy
- 所有已知实现类:
CheckpointAlgorithmAdapter
,CompletionPolicySupport
,CompositeCompletionPolicy
,CountingCompletionPolicy
,DefaultResultCompletionPolicy
,SimpleCompletionPolicy
,StepExecutionSimpleCompletionPolicy
,TimeoutTerminationPolicy
public interface CompletionPolicy
Interface for batch completion policies, to enable batch operations to strategise normal completion conditions. Stateful implementations of batch iterators should only update state using the update method. If you need custom behaviour consider extending an existing implementation or using the composite provided.- 作者:
- Dave Syer
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 boolean
isComplete(RepeatContext context)
Allow policy to signal completion according to internal state, without having to wait for the callback to complete.boolean
isComplete(RepeatContext context, RepeatStatus result)
Determine whether a batch is complete given the latest result from the callback.RepeatContext
start(RepeatContext parent)
Create a new context for the execution of a batch.void
update(RepeatContext context)
Give implementations the opportunity to update the state of the current batch.
方法详细资料
isComplete
boolean isComplete(RepeatContext context, RepeatStatus result)
Determine whether a batch is complete given the latest result from the callback. If this method returns true thenisComplete(RepeatContext)
should also (but not necessarily vice versa, since the answer here depends on the result).- 参数:
context
- the current batch context.result
- the result of the latest batch item processing.- 返回:
- true if the batch should terminate.
- 另请参阅:
isComplete(RepeatContext)
isComplete
boolean isComplete(RepeatContext context)
Allow policy to signal completion according to internal state, without having to wait for the callback to complete.- 参数:
context
- the current batch context.- 返回:
- true if the batch should terminate.
start
RepeatContext start(RepeatContext parent)
Create a new context for the execution of a batch. N.B. implementations should not return the parent from this method - they must create a new context to meet the specific needs of the policy. The best way to do this might be to override an existing implementation and use theRepeatContext
to store state in its attributes.- 参数:
parent
- the current context if one is already in progress.- 返回:
- a context object that can be used by the implementation to store internal state for a batch.
update
void update(RepeatContext context)
Give implementations the opportunity to update the state of the current batch. Will be called once per callback, after it has been launched, but not necessarily after it completes (if the batch is asynchronous).- 参数:
context
- the value returned by start.