Class RepeatContextSupport
java.lang.Object
org.springframework.batch.repeat.context.SynchronizedAttributeAccessor
org.springframework.batch.repeat.context.RepeatContextSupport
- All Implemented Interfaces:
- RepeatContext,- org.springframework.core.AttributeAccessor
- Direct Known Subclasses:
- CompositeCompletionPolicy.CompositeBatchContext,- CountingCompletionPolicy.CountingBatchContext,- SimpleCompletionPolicy.SimpleTerminationContext,- TimeoutTerminationPolicy.TimeoutBatchContext
- 
Constructor SummaryConstructorsConstructorDescriptionRepeatContextSupport(RepeatContext parent) Constructor forRepeatContextSupport.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Allow resources to be cleared, especially in destruction callbacks.If batches are nested, then the inner batch will be created with the outer one as a parent.intPublic access to a counter for the number of operations attempted.voidUsed by clients to increment the started count.booleanPublic accessor for the complete flag.booleanPublic accessor for the termination flag.voidregisterDestructionCallback(String name, Runnable callback) Register a callback to be executed on close, associated with the attribute having the given name.voidSignal to the framework that the current batch should complete normally, independent of the currentCompletionPolicy.voidSignal to the framework that the current batch should complete abnormally, independent of the currentCompletionPolicy.Methods inherited from class org.springframework.batch.repeat.context.SynchronizedAttributeAccessorattributeNames, equals, getAttribute, hasAttribute, hashCode, removeAttribute, setAttribute, setAttributeIfAbsent, toStringMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.AttributeAccessorattributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttribute
- 
Constructor Details- 
RepeatContextSupportConstructor forRepeatContextSupport. The parent can be null, but should be set to the enclosing repeat context if there is one, e.g. if this context is an inner loop.- Parameters:
- parent-- RepeatContextto be used as the parent context.
 
 
- 
- 
Method Details- 
isCompleteOnlypublic boolean isCompleteOnly()Description copied from interface:RepeatContextPublic accessor for the complete flag.- Specified by:
- isCompleteOnlyin interface- RepeatContext
- Returns:
- indicator if the repeat is complete
 
- 
setCompleteOnlypublic void setCompleteOnly()Description copied from interface:RepeatContextSignal to the framework that the current batch should complete normally, independent of the currentCompletionPolicy.- Specified by:
- setCompleteOnlyin interface- RepeatContext
 
- 
isTerminateOnlypublic boolean isTerminateOnly()Description copied from interface:RepeatContextPublic accessor for the termination flag. If this flag is set then the complete flag will also be.- Specified by:
- isTerminateOnlyin interface- RepeatContext
- Returns:
- indicates if the repeat should terminate
 
- 
setTerminateOnlypublic void setTerminateOnly()Description copied from interface:RepeatContextSignal to the framework that the current batch should complete abnormally, independent of the currentCompletionPolicy.- Specified by:
- setTerminateOnlyin interface- RepeatContext
 
- 
getParentDescription copied from interface:RepeatContextIf 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.- Specified by:
- getParentin interface- RepeatContext
- Returns:
- the parent context or null if there is none
 
- 
incrementpublic void increment()Used by clients to increment the started count.
- 
getStartedCountpublic int getStartedCount()Description copied from interface:RepeatContextPublic access to a counter for the number of operations attempted.- Specified by:
- getStartedCountin interface- RepeatContext
- Returns:
- the number of batch operations started.
 
- 
registerDestructionCallbackDescription copied from interface:RepeatContextRegister a callback to be executed on close, associated with the attribute having the given name. TheRunnablecallback should not throw any exceptions.- Specified by:
- registerDestructionCallbackin interface- RepeatContext
- Parameters:
- name- the name of the attribute to associated this callback with. If this attribute is removed the callback should never be called.
- callback- a- Runnableto execute when the context is closed.
 
- 
closepublic void close()Description copied from interface:RepeatContextAllow 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.- Specified by:
- closein interface- RepeatContext
 
 
-