Class SynchronizedItemReader<T>
java.lang.Object
org.springframework.batch.infrastructure.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 theread
method of the delegate and is synchronized with a lock.- Specified by:
read
in interfaceItemReader<T>
- Returns:
- T the item to be processed or
null
if the data source is exhausted - Throws:
Exception
- if an error occurs.
-