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 theExecutionContextfor 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 voidclose()No-op.protected abstract java.io.SerializabledoCheckpoint()Used to provide aSerializablerepresenting the current state of the batch artifact.protected abstract voiddoClose()Used to close the underlying batch artifactprotected abstract voiddoOpen(java.io.Serializable checkpoint)Used to open a batch artifact with previously saved checkpoint information.voidopen(ExecutionContext executionContext)No-op.voidupdate(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: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:
ItemStream.open(ExecutionContext)
doOpen
protected abstract void doOpen(java.io.Serializable checkpoint) throws java.lang.ExceptionUsed 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:ItemStreamSupportReturn emptyExecutionContext.- Specified by:
updatein interfaceItemStream- Overrides:
updatein classItemStreamSupport- Parameters:
executionContext- to be updated- Throws:
ItemStreamException- See Also:
ItemStream.update(ExecutionContext)
doCheckpoint
protected abstract java.io.Serializable doCheckpoint() throws java.lang.ExceptionUsed to provide aSerializablerepresenting 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 ItemStreamExceptionDescription copied from class:ItemStreamSupportNo-op.- Specified by:
closein interfaceItemStream- Overrides:
closein classItemStreamSupport- Throws:
ItemStreamException- See Also:
ItemStream.close()
doClose
protected abstract void doClose() throws java.lang.ExceptionUsed to close the underlying batch artifact- Throws:
java.lang.Exception- thrown by the underlying implementation