Class SynchronizedItemReader<T>
java.lang.Object
org.springframework.batch.item.support.SynchronizedItemReader<T>
- Type Parameters:
T- type of objects to read
- All Implemented Interfaces:
ItemReader<T>
This is an
ItemReader decorator with a synchronized ItemReader.read()
method. This decorator is useful when using a non thread-safe item reader in a
multi-threaded step.- Since:
- 5.1.0
- Author:
- Mahmoud Ben Hassine
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SynchronizedItemReader
-
-
Method Details
-
read
This method delegates to thereadmethod of the delegate and is synchronized with a lock.- Specified by:
readin interfaceItemReader<T>- Returns:
- T the item to be processed or
nullif the data source is exhausted - Throws:
ParseException- if there is a problem parsing the current record (but the next one may still be valid)NonTransientResourceException- if there is a fatal exception in the underlying resource. After throwing this exception implementations should endeavour to return null from subsequent calls to read.UnexpectedInputException- if there is an uncategorised problem with the input data. Assume potentially transient, so subsequent calls to read might succeed.Exception- if an there is a non-specific error.
-