Package javax.batch.api.chunk
Interface ItemWriter
- All Known Implementing Classes:
AbstractItemWriter
public interface ItemWriter
ItemWriter defines the batch artifact that writes to a
list of items for chunk processing.
-
Method Summary
Modifier and TypeMethodDescriptionThe checkpointInfo method returns the current checkpoint data for this writer.void
close()
The close method marks the end of use of the ItemWriter.void
open
(Serializable checkpoint) The open method prepares the writer to write items.void
writeItems
(List<Object> items) The writeItems method writes a list of item for the current chunk.
-
Method Details
-
open
The open method prepares the writer to write items. The input parameter represents the last checkpoint for this writer in a given job instance. The checkpoint data is defined by this writer and is provided by the checkpointInfo method. The checkpoint data provides the writer whatever information it needs to resume writing items upon restart. A checkpoint value of null is passed upon initial start.- Parameters:
checkpoint
- specifies the last checkpoint- Throws:
Exception
- is thrown for any errors.
-
close
The close method marks the end of use of the ItemWriter. The writer is free to do any cleanup necessary.- Throws:
Exception
- is thrown for any errors.
-
writeItems
The writeItems method writes a list of item for the current chunk.- Parameters:
items
- specifies the list of items to write. This may be an empty list (e.g. if all the items have been filtered out by the ItemProcessor).- Throws:
Exception
- is thrown for any errors.
-
checkpointInfo
The checkpointInfo method returns the current checkpoint data for this writer. It is called before a chunk checkpoint is committed.- Returns:
- checkpoint data
- Throws:
Exception
- is thrown for any errors.
-