类 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 standardRepeatTemplate
should ensure this contract is kept, but it needs to be carefully monitored.- 作者:
- Dave Syer
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected class
SimpleCompletionPolicy.SimpleTerminationContext
字段概要
字段 修饰符和类型 字段 说明 static int
DEFAULT_CHUNK_SIZE
构造器概要
构造器 构造器 说明 SimpleCompletionPolicy()
SimpleCompletionPolicy(int chunkSize)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
isComplete(RepeatContext context)
Terminate if the chunk size has been reached.boolean
isComplete(RepeatContext context, RepeatStatus result)
Terminate if the chunk size has been reached, or the result is null.void
setChunkSize(int chunkSize)
RepeatContext
start(RepeatContext context)
Reset the counter.java.lang.String
toString()
void
update(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