Class ChunkMonitor
java.lang.Object
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.core.step.item.ChunkMonitor
- All Implemented Interfaces:
ItemStream
Manage the offset data between the last successful commit and updates made to
an input chunk. Only works with single threaded steps because it has to use a
ThreadLocal to manage the state and coordinate between the caller
and the wrapped ItemStream.- Since:
- 2.0
- Author:
- Dave Syer
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()No-op.intvoidvoidopen(ExecutionContext executionContext) No-op.voidregisterItemStream(ItemStream stream) voidvoidsetChunkSize(int chunkSize) voidsetItemReader(ItemReader<?> reader) voidupdate(ExecutionContext executionContext) Return emptyExecutionContext.Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
-
Constructor Details
-
ChunkMonitor
public ChunkMonitor()
-
-
Method Details
-
registerItemStream
- Parameters:
stream- the stream to set
-
setItemReader
- Parameters:
reader- the reader to set
-
incrementOffset
public void incrementOffset() -
getOffset
public int getOffset() -
resetOffset
public void resetOffset() -
setChunkSize
public void setChunkSize(int chunkSize) -
close
Description copied from class:ItemStreamSupportNo-op.- Specified by:
closein interfaceItemStream- Overrides:
closein classItemStreamSupport- Throws:
ItemStreamException- See Also:
-
open
Description copied from class:ItemStreamSupportNo-op.- Specified by:
openin interfaceItemStream- Overrides:
openin classItemStreamSupport- Parameters:
executionContext- current step'sExecutionContext. Will be the executionContext from the last run of the step on a restart.- Throws:
ItemStreamException- See Also:
-
update
Description copied from class:ItemStreamSupportReturn emptyExecutionContext.- Specified by:
updatein interfaceItemStream- Overrides:
updatein classItemStreamSupport- Parameters:
executionContext- to be updated- Throws:
ItemStreamException- See Also:
-