类 StepContextRepeatCallback
- java.lang.Object
- org.springframework.batch.core.scope.context.StepContextRepeatCallback
- 所有已实现的接口:
RepeatCallback
public abstract class StepContextRepeatCallback extends java.lang.Object implements RepeatCallback
Convenient base class for clients who need to do something in a repeat callback inside aStep
.- 作者:
- Dave Syer, Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 StepContextRepeatCallback(StepExecution stepExecution)
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 abstract RepeatStatus
doInChunkContext(RepeatContext context, ChunkContext chunkContext)
Do the work required for this chunk of the step.RepeatStatus
doInIteration(RepeatContext context)
Manage theStepContext
lifecycle.
构造器详细资料
StepContextRepeatCallback
public StepContextRepeatCallback(StepExecution stepExecution)
- 参数:
stepExecution
- instance ofStepExecution
to be used by StepContextRepeatCallback.
方法详细资料
doInIteration
public RepeatStatus doInIteration(RepeatContext context) throws java.lang.Exception
Manage theStepContext
lifecycle. Business processing should be delegated todoInChunkContext(RepeatContext, ChunkContext)
. This is to ensure that the current thread has a reference to the context, even if the callback is executed in a pooled thread. Handles the registration and unregistration of the step context, so clients should not duplicate those calls.- 指定者:
doInIteration
在接口中RepeatCallback
- 参数:
context
- the current context passed in by the caller.- 返回:
- an
RepeatStatus
which is continuable if there is (or may be) more data to process. - 抛出:
java.lang.Exception
- if there is a problem with the processing.- 另请参阅:
RepeatCallback.doInIteration(RepeatContext)
doInChunkContext
public abstract RepeatStatus doInChunkContext(RepeatContext context, ChunkContext chunkContext) throws java.lang.Exception
Do the work required for this chunk of the step. TheChunkContext
provided is managed by the base class, so that if there is still work to do for the task in hand state can be stored here. In a multi-threaded client, the base class ensures that only one thread at a time can be working on each instance ofChunkContext
. Workers should signal that they are finished with a context by removing all the attributes they have added. If a worker does not remove them another thread might see stale state.- 参数:
context
- the currentRepeatContext
chunkContext
- the chunk context in which to carry out the work- 返回:
- the repeat status from the execution
- 抛出:
java.lang.Exception
- implementations can throw an exception if anything goes wrong