javax.batch.api.chunk
Interface ItemWriter<T>

All Known Implementing Classes:
AbstractItemWriter

public interface ItemWriter<T>


Method Summary
 Serializable checkpointInfo()
          The checkpointInfo method returns the current checkpoint position for this writer.
 void close()
          The close method marks the end of use of the item stream.
 void open(Serializable checkpoint)
          The open method prepare the writer to write items.
 void writeItems(List<T> items)
          The writeItems method writes a list of item for the current chunk to the item writer stream.
 

Method Detail

open

void open(Serializable checkpoint)
          throws Exception
The open method prepare 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 instructs the writer where to reposition the stream upon job restart. A checkpoint value of null means reposition from the start of stream or rely on an application managed means of determining whether to position for start or restart. The persistent area of the StepContext may be used to implement application managed stream repositioning.

Parameters:
checkpoint - specifies the last checkpoint
Throws:
Exception - is thrown for any errors.

close

void close()
           throws Exception
The close method marks the end of use of the item stream. The writer is free to do any cleanup necessary on the stream.

Throws:
Exception - is thrown for any errors.

writeItems

void writeItems(List<T> items)
                throws Exception
The writeItems method writes a list of item for the current chunk to the item writer stream.

Parameters:
items - specifies the list of items to write.
Throws:
Exception - is thrown for any errors.

checkpointInfo

Serializable checkpointInfo()
                            throws Exception
The checkpointInfo method returns the current checkpoint position for this writer. It is called before a chunk checkpoint is committed.

Returns:
checkpoint data
Throws:
Exception - is thrown for any errors.


Copyright © 2013. All Rights Reserved.