Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add synchronized decorators for non-stream item readers/writers #4368

Closed
fmbenhassine opened this issue May 8, 2023 · 2 comments
Closed

Comments

@fmbenhassine
Copy link
Contributor

Currently, Spring Batch provides two decorators (SynchronizedItemStreamReader and SynchronizedItemStreamWriter) to synchronize thread access to ItemStreamReader#read and ItemStreamWriter#write.

While those decorators work with ItemStreams, they are not usable with non item streams as they respectively accept ItemStreamReader and ItemStreamWriter as delegates. For example, those decorators cannot be used to synchronize access to ListItemReader#read (#3741) orKafkaItemWriter#write (#3970).

The goal of this issue is to add two decorators that accept ItemReader and ItemWriter as delegates and synchronize access to the read and write operations.

@hpoettker
Copy link
Contributor

Are there already plans for the API to instantiate SynchronizedItemReader or SynchronizedItemWriter?

It should be consistent with the corresponding decorators for ItemStream, which can be instantiated with a no-args-constructor and a setter for the delegate, or a builder with a more fluent API. But in my opinion, both options feel a bit clunky today. Are there plans to allow more concise instanstiations like SynchronizedItemReader.of(delegate) or new SynchronizedItemReader(delegate)?

@fmbenhassine
Copy link
Contributor Author

@hpoettker

Are there plans to allow more concise instanstiations like SynchronizedItemReader.of(delegate) or new SynchronizedItemReader(delegate)?

Yes, there will be a constructor that accepts the delegate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants