类 TimeoutTerminationPolicy
- java.lang.Object
- org.springframework.batch.repeat.policy.CompletionPolicySupport
- org.springframework.batch.repeat.policy.TimeoutTerminationPolicy
- 所有已实现的接口:
CompletionPolicy
public class TimeoutTerminationPolicy extends CompletionPolicySupport
Termination policy that times out after a fixed period. Allows graceful exit from a batch if the latest result comes in after the timeout expires (i.e. does not throw a timeout exception).
N.B. It may often be the case that the batch governed by this policy will be transactional, and the transaction might have its own timeout. In this case the transaction might throw a timeout exception on commit if its timeout threshold is lower than the termination policy.- 作者:
- Dave Syer
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected class
TimeoutTerminationPolicy.TimeoutBatchContext
字段概要
字段 修饰符和类型 字段 说明 static long
DEFAULT_TIMEOUT
Default timeout value in milliseconds (the value equivalent to 30 seconds).
构造器概要
构造器 构造器 说明 TimeoutTerminationPolicy()
Default constructor.TimeoutTerminationPolicy(long timeout)
Construct aTimeoutTerminationPolicy
with the specified timeout value (in milliseconds).
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
isComplete(RepeatContext context)
Check the timeout and complete gracefully if it has expires.RepeatContext
start(RepeatContext context)
Start the clock on the timeout.从类继承的方法 org.springframework.batch.repeat.policy.CompletionPolicySupport
isComplete, update
字段详细资料
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT
Default timeout value in milliseconds (the value equivalent to 30 seconds).- 另请参阅:
- 常量字段值
构造器详细资料
TimeoutTerminationPolicy
public TimeoutTerminationPolicy()
Default constructor.
TimeoutTerminationPolicy
public TimeoutTerminationPolicy(long timeout)
Construct aTimeoutTerminationPolicy
with the specified timeout value (in milliseconds).- 参数:
timeout
- duration of the timeout.
方法详细资料
isComplete
public boolean isComplete(RepeatContext context)
Check the timeout and complete gracefully if it has expires.- 指定者:
isComplete
在接口中CompletionPolicy
- 覆盖:
isComplete
在类中CompletionPolicySupport
- 参数:
context
- the current batch context.- 返回:
- true if the batch should terminate.
- 另请参阅:
CompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext)
start
public RepeatContext start(RepeatContext context)
Start the clock on the timeout.- 指定者:
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)