类 FaultTolerantChunkProvider<I>
- java.lang.Object
- org.springframework.batch.core.step.item.SimpleChunkProvider<I>
- org.springframework.batch.core.step.item.FaultTolerantChunkProvider<I>
- 所有已实现的接口:
ChunkProvider<I>
public class FaultTolerantChunkProvider<I> extends SimpleChunkProvider<I>
FaultTolerant implementation of theChunkProcessor
interface, that allows for skipping or retry of items that cause exceptions during reading or processing.
字段概要
字段 修饰符和类型 字段 说明 static int
DEFAULT_MAX_SKIPS_ON_READ
Hard limit for number of read skips in the same chunk.从类继承的字段 org.springframework.batch.core.step.item.SimpleChunkProvider
itemReader, logger
构造器概要
构造器 构造器 说明 FaultTolerantChunkProvider(ItemReader<? extends I> itemReader, RepeatOperations repeatOperations)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
postProcess(StepContribution contribution, Chunk<I> chunk)
protected I
read(StepContribution contribution, Chunk<I> chunk)
Delegates toSimpleChunkProvider.doRead()
.void
setMaxSkipsOnRead(int maxSkipsOnRead)
void
setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
Classifier to determine whether exceptions have been marked as no-rollback (as opposed to skippable).void
setSkipPolicy(SkipPolicy skipPolicy)
The policy that determines whether exceptions can be skipped on read.从类继承的方法 org.springframework.batch.core.step.item.SimpleChunkProvider
doRead, getListener, provide, registerListener, setListeners
字段详细资料
DEFAULT_MAX_SKIPS_ON_READ
public static final int DEFAULT_MAX_SKIPS_ON_READ
Hard limit for number of read skips in the same chunk. Should be sufficiently high that it is only encountered in a runaway step where all items are skipped before the chunk can complete (leading to a potential heap memory problem).- 另请参阅:
- 常量字段值
构造器详细资料
FaultTolerantChunkProvider
public FaultTolerantChunkProvider(ItemReader<? extends I> itemReader, RepeatOperations repeatOperations)
方法详细资料
setMaxSkipsOnRead
public void setMaxSkipsOnRead(int maxSkipsOnRead)
- 参数:
maxSkipsOnRead
- the maximum number of skips on read
setSkipPolicy
public void setSkipPolicy(SkipPolicy skipPolicy)
The policy that determines whether exceptions can be skipped on read.- 参数:
skipPolicy
- instance ofSkipPolicy
to be used by FaultTolerantChunkProvider.
setRollbackClassifier
public void setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
Classifier to determine whether exceptions have been marked as no-rollback (as opposed to skippable). If encountered they are simply ignored, unless also skippable.- 参数:
rollbackClassifier
- the rollback classifier to set
read
protected I read(StepContribution contribution, Chunk<I> chunk) throws java.lang.Exception
从类复制的说明:SimpleChunkProvider
Delegates toSimpleChunkProvider.doRead()
. Subclasses can add additional behaviour (e.g. exception handling).- 覆盖:
read
在类中SimpleChunkProvider<I>
- 参数:
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
postProcess
public void postProcess(StepContribution contribution, Chunk<I> chunk)
- 指定者:
postProcess
在接口中ChunkProvider<I>
- 覆盖:
postProcess
在类中SimpleChunkProvider<I>