类 SimpleCompletionPolicy
- java.lang.Object
- org.springframework.batch.repeat.policy.CompletionPolicySupport
- org.springframework.batch.repeat.policy.DefaultResultCompletionPolicy
- org.springframework.batch.repeat.policy.SimpleCompletionPolicy
- 所有已实现的接口:
CompletionPolicy
public class SimpleCompletionPolicy extends DefaultResultCompletionPolicy
Policy for terminating a batch after a fixed number of operations. Internal state is maintained and a counter incremented, so successful use of this policy requires that isComplete() is only called once per batch item. Using the standardRepeatTemplateshould ensure this contract is kept, but it needs to be carefully monitored.- 作者:
- Dave Syer
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected classSimpleCompletionPolicy.SimpleTerminationContext
字段概要
字段 修饰符和类型 字段 说明 static intDEFAULT_CHUNK_SIZE
构造器概要
构造器 构造器 说明 SimpleCompletionPolicy()SimpleCompletionPolicy(int chunkSize)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanisComplete(RepeatContext context)Terminate if the chunk size has been reached.booleanisComplete(RepeatContext context, RepeatStatus result)Terminate if the chunk size has been reached, or the result is null.voidsetChunkSize(int chunkSize)RepeatContextstart(RepeatContext context)Reset the counter.java.lang.StringtoString()voidupdate(RepeatContext context)Increment the counter in the context.
字段详细资料
DEFAULT_CHUNK_SIZE
public static final int DEFAULT_CHUNK_SIZE
- 另请参阅:
- 常量字段值
构造器详细资料
SimpleCompletionPolicy
public SimpleCompletionPolicy()
SimpleCompletionPolicy
public SimpleCompletionPolicy(int chunkSize)
方法详细资料
setChunkSize
public void setChunkSize(int chunkSize)
start
public RepeatContext start(RepeatContext context)
Reset the counter.- 指定者:
start在接口中CompletionPolicy- 覆盖:
start在类中CompletionPolicySupport- 参数:
context- 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.
- 另请参阅:
CompletionPolicy.start(RepeatContext)
isComplete
public boolean isComplete(RepeatContext context, RepeatStatus result)
Terminate if the chunk size has been reached, or the result is null.- 指定者:
isComplete在接口中CompletionPolicy- 覆盖:
isComplete在类中DefaultResultCompletionPolicy- 参数:
context- the current batch context.result- the result of the latest batch item processing.- 返回:
- true if the batch should terminate.
- 抛出:
java.lang.RuntimeException- (normally terminating the batch) if the result is itself an exception.- 另请参阅:
CompletionPolicy.isComplete(RepeatContext, RepeatStatus)
isComplete
public boolean isComplete(RepeatContext context)
Terminate if the chunk size has been reached.- 指定者:
isComplete在接口中CompletionPolicy- 覆盖:
isComplete在类中DefaultResultCompletionPolicy- 参数:
context- the current batch context.- 返回:
- true if the batch should terminate.
- 另请参阅:
CompletionPolicy.isComplete(RepeatContext)
update
public void update(RepeatContext context)
Increment the counter in the context.- 指定者:
update在接口中CompletionPolicy- 覆盖:
update在类中CompletionPolicySupport- 参数:
context- the value returned by start.- 另请参阅:
CompletionPolicy.update(RepeatContext)
toString
public java.lang.String toString()
- 覆盖:
toString在类中java.lang.Object