Class SynchronizedItemWriter<T>
java.lang.Object
org.springframework.batch.item.support.SynchronizedItemWriter<T>
- Type Parameters:
T
- type of objects to write
- All Implemented Interfaces:
ItemWriter<T>
This is an
ItemWriter
decorator with a synchronized ItemWriter.write(org.springframework.batch.item.Chunk<? extends T>)
method. This decorator is useful when using a non thread-safe item writer in a
multi-threaded step.- Since:
- 5.1.0
- Author:
- Mahmoud Ben Hassine
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
SynchronizedItemWriter
-
-
Method Details
-
write
This method delegates to thewrite
method of the delegate and is synchronized with a lock.- Specified by:
write
in interfaceItemWriter<T>
- Parameters:
items
- of items to be written. Must not benull
.- Throws:
Exception
- if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
-