类 SimpleChunkProvider<I>
- java.lang.Object
- org.springframework.batch.core.step.item.SimpleChunkProvider<I>
- 所有已实现的接口:
ChunkProvider<I>
- 直接已知子类:
FaultTolerantChunkProvider
public class SimpleChunkProvider<I> extends java.lang.Object implements ChunkProvider<I>
Simple implementation of the ChunkProvider interface that does basic chunk providing from anItemReader
.- 作者:
- Dave Syer, Michael Minella, Mahmoud Ben Hassine
- 另请参阅:
ChunkOrientedTasklet
字段概要
字段 修饰符和类型 字段 说明 protected ItemReader<? extends I>
itemReader
protected org.apache.commons.logging.Log
logger
构造器概要
构造器 构造器 说明 SimpleChunkProvider(ItemReader<? extends I> itemReader, RepeatOperations repeatOperations)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected I
doRead()
Surrounds the read call with listener callbacks.protected MulticasterBatchListener<I,?>
getListener()
void
postProcess(StepContribution contribution, Chunk<I> chunk)
Chunk<I>
provide(StepContribution contribution)
protected I
read(StepContribution contribution, Chunk<I> chunk)
Delegates todoRead()
.void
registerListener(StepListener listener)
Register a listener for callbacks at the appropriate stages in a process.void
setListeners(java.util.List<? extends StepListener> listeners)
Register someStepListener
s with the handler.
字段详细资料
logger
protected final org.apache.commons.logging.Log logger
itemReader
protected final ItemReader<? extends I> itemReader
构造器详细资料
SimpleChunkProvider
public SimpleChunkProvider(ItemReader<? extends I> itemReader, RepeatOperations repeatOperations)
方法详细资料
setListeners
public void setListeners(java.util.List<? extends StepListener> listeners)
Register someStepListener
s with the handler. Each will get the callbacks in the order specified at the correct stage.- 参数:
listeners
- list ofStepListener
s.
registerListener
public void registerListener(StepListener listener)
Register a listener for callbacks at the appropriate stages in a process.- 参数:
listener
- aStepListener
getListener
protected MulticasterBatchListener<I,?> getListener()
- 返回:
- the listener
doRead
@Nullable protected final I doRead() throws java.lang.Exception
Surrounds the read call with listener callbacks.- 返回:
- the item or
null
if the data source is exhausted - 抛出:
java.lang.Exception
- is thrown if error occurs during read.
provide
public Chunk<I> provide(StepContribution contribution) throws java.lang.Exception
- 指定者:
provide
在接口中ChunkProvider<I>
- 抛出:
java.lang.Exception
postProcess
public void postProcess(StepContribution contribution, Chunk<I> chunk)
- 指定者:
postProcess
在接口中ChunkProvider<I>
read
@Nullable protected I read(StepContribution contribution, Chunk<I> chunk) throws SkipOverflowException, java.lang.Exception
Delegates todoRead()
. Subclasses can add additional behaviour (e.g. exception handling).- 参数:
contribution
- the current step execution contributionchunk
- the current chunk- 返回:
- a new item for processing or
null
if the data source is exhausted - 抛出:
SkipOverflowException
- if specifically the chunk is accumulating too much data (e.g. skips) and it wants to force a commit.java.lang.Exception
- if there is a generic issue