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, Mahmoud Ben Hassine
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
void
void
open
(ExecutionContext executionContext) void
registerItemStream
(ItemStream stream) void
void
setChunkSize
(int chunkSize) void
setItemReader
(ItemReader<?> reader) void
update
(ExecutionContext executionContext) Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, getName, 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
- Specified by:
close
in interfaceItemStream
- Overrides:
close
in classItemStreamSupport
- Throws:
ItemStreamException
-
open
- Specified by:
open
in interfaceItemStream
- Overrides:
open
in classItemStreamSupport
- Throws:
ItemStreamException
-
update
- Specified by:
update
in interfaceItemStream
- Overrides:
update
in classItemStreamSupport
- Throws:
ItemStreamException
-