Class CheckpointSupport
- java.lang.Object
- org.springframework.batch.item.ItemStreamSupport
- org.springframework.batch.jsr.item.CheckpointSupport
- All Implemented Interfaces:
ItemStream
- Direct Known Subclasses:
ItemReaderAdapter
,ItemWriterAdapter
public abstract class CheckpointSupport extends ItemStreamSupport
Provides support for JSR-352 checkpointing. Checkpoint objects are copied prior to being added to theExecutionContext
for persistence by the framework. If the checkpoint object cannot be copied and further changes occur to the same instance, side effects may occur. In cases like this, it is recommended that a copy of the object being acted upon in the reader/writer is returned via theItemReader.checkpointInfo()
orItemWriter.checkpointInfo()
calls.- Since:
- 3.0
- Author:
- Michael Minella
Constructor Summary
Constructors Constructor Description CheckpointSupport(java.lang.String checkpointKey)
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
No-op.protected abstract java.io.Serializable
doCheckpoint()
Used to provide aSerializable
representing the current state of the batch artifact.protected abstract void
doClose()
Used to close the underlying batch artifactprotected abstract void
doOpen(java.io.Serializable checkpoint)
Used to open a batch artifact with previously saved checkpoint information.void
open(ExecutionContext executionContext)
No-op.void
update(ExecutionContext executionContext)
Return emptyExecutionContext
.Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
Constructor Detail
CheckpointSupport
public CheckpointSupport(java.lang.String checkpointKey)
- Parameters:
checkpointKey
- key to store the checkpoint object with in theExecutionContext
Method Detail
open
public void open(ExecutionContext executionContext) throws ItemStreamException
Description copied from class:ItemStreamSupport
No-op.- Specified by:
open
in interfaceItemStream
- Overrides:
open
in classItemStreamSupport
- Parameters:
executionContext
- current step'sExecutionContext
. Will be the executionContext from the last run of the step on a restart.- Throws:
ItemStreamException
- See Also:
ItemStream.open(ExecutionContext)
doOpen
protected abstract void doOpen(java.io.Serializable checkpoint) throws java.lang.Exception
Used to open a batch artifact with previously saved checkpoint information.- Parameters:
checkpoint
- previously saved checkpoint object- Throws:
java.lang.Exception
- thrown by the implementation
update
public void update(ExecutionContext executionContext) throws ItemStreamException
Description copied from class:ItemStreamSupport
Return emptyExecutionContext
.- Specified by:
update
in interfaceItemStream
- Overrides:
update
in classItemStreamSupport
- Parameters:
executionContext
- to be updated- Throws:
ItemStreamException
- See Also:
ItemStream.update(ExecutionContext)
doCheckpoint
protected abstract java.io.Serializable doCheckpoint() throws java.lang.Exception
Used to provide aSerializable
representing the current state of the batch artifact.- Returns:
- the current state of the batch artifact
- Throws:
java.lang.Exception
- thrown by the implementation
close
public void close() throws ItemStreamException
Description copied from class:ItemStreamSupport
No-op.- Specified by:
close
in interfaceItemStream
- Overrides:
close
in classItemStreamSupport
- Throws:
ItemStreamException
- See Also:
ItemStream.close()
doClose
protected abstract void doClose() throws java.lang.Exception
Used to close the underlying batch artifact- Throws:
java.lang.Exception
- thrown by the underlying implementation