|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ItemReader
Strategy interface for providing the data.
Implementations are expected to be stateful and will be called multiple times
for each batch, with each call to read()
returning a different value
and finally returning null
when all input data is
exhausted.
Implementations need *not* be thread safe and clients of a ItemReader
need to be aware that this is the case.
A richer interface (e.g. with a look ahead or peek) is not feasible because
we need to support transactions in an asynchronous batch.
Method Summary | |
---|---|
void |
mark()
Mark the stream so that it can be reset later and the items backed out. Mark is called before reading a new chunk of items - in case of rollback mark will not be called again before re-processing the chunk. |
Object |
read()
Reads a piece of input data and advance to the next one. |
void |
reset()
Reset the stream to the last mark. |
Method Detail |
---|
Object read() throws Exception, UnexpectedInputException, NoWorkFoundException, ParseException
null
at the end of the input
data set. In a transactional setting, caller might get the same item
twice from successive calls (or otherwise), if the first call was in a
transaction that rolled back.
Exception
- if an underlying resource is unavailable.
UnexpectedInputException
NoWorkFoundException
ParseException
void mark() throws MarkFailedException
MarkFailedException
- if there is a problem with the mark. If a
mark fails inside a transaction, it would be worrying, but not normally
fatal.void reset() throws ResetFailedException
ResetFailedException
- if there is a problem with the reset. If a
reset fails inside a transaction, it would normally be fatal, and would
leave the stream in an inconsistent state. So while this is an unchecked
exception, it may be important for a client to catch it explicitly.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |