接口 RepeatContext
- 所有超级接口:
org.springframework.core.AttributeAccessor
- 所有已知实现类:
CompositeCompletionPolicy.CompositeBatchContext
,CountingCompletionPolicy.CountingBatchContext
,RepeatContextSupport
,SimpleCompletionPolicy.SimpleTerminationContext
,TimeoutTerminationPolicy.TimeoutBatchContext
public interface RepeatContext extends org.springframework.core.AttributeAccessor
Base interface for context which controls the state and completion / termination of a batch step. A new context is created for each call to theRepeatOperations
. Within a batch callback code can communicate via theAttributeAccessor
interface.- 作者:
- Dave Syer
- 另请参阅:
RepeatOperations.iterate(RepeatCallback)
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 void
close()
Allow resources to be cleared, especially in destruction callbacks.RepeatContext
getParent()
If batches are nested, then the inner batch will be created with the outer one as a parent.int
getStartedCount()
Public access to a counter for the number of operations attempted.boolean
isCompleteOnly()
Public accessor for the complete flag.boolean
isTerminateOnly()
Public accessor for the termination flag.void
registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
Register a callback to be executed on close, associated with the attribute having the given name.void
setCompleteOnly()
Signal to the framework that the current batch should complete normally, independent of the currentCompletionPolicy
.void
setTerminateOnly()
Signal to the framework that the current batch should complete abnormally, independent of the currentCompletionPolicy
.
方法详细资料
getParent
RepeatContext getParent()
If batches are nested, then the inner batch will be created with the outer one as a parent. This is an accessor for the parent if it exists.- 返回:
- the parent context or null if there is none
getStartedCount
int getStartedCount()
Public access to a counter for the number of operations attempted.- 返回:
- the number of batch operations started.
setCompleteOnly
void setCompleteOnly()
Signal to the framework that the current batch should complete normally, independent of the currentCompletionPolicy
.
isCompleteOnly
boolean isCompleteOnly()
Public accessor for the complete flag.- 返回:
- indicator if the repeat is complete
setTerminateOnly
void setTerminateOnly()
Signal to the framework that the current batch should complete abnormally, independent of the currentCompletionPolicy
.
isTerminateOnly
boolean isTerminateOnly()
Public accessor for the termination flag. If this flag is set then the complete flag will also be.- 返回:
- indicates if the repeat should terminate
registerDestructionCallback
void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
Register a callback to be executed on close, associated with the attribute having the given name. TheRunnable
callback should not throw any exceptions.- 参数:
name
- the name of the attribute to associated this callback with. If this attribute is removed the callback should never be called.callback
- aRunnable
to execute when the context is closed.
close
void close()
Allow resources to be cleared, especially in destruction callbacks. Implementations should ensure that any registered destruction callbacks are executed here, as long as the corresponding attribute is still available.