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

DataBufferUtils.read should not take input stream/channel as parameter [SPR-16403] #20949

Closed
spring-issuemaster opened this issue Jan 19, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jan 19, 2018

Arjen Poutsma opened SPR-16403 and commented

Currently, all read variants on DataBufferUtils take an input stream or channel as first parameter. When the last data is read, the channel is closed. This results in a "read-once" flux of data buffers.

However, (most) Fluxes are expected to be subscribed to multiple times, not once. As such, the read methods should take an input stream/channel supplier as argument instead. This allows the channel to be opened for the second time when another subscription comes along.

Using Supplier seems good enough, except that most I/O related methods throw IOException, and Supplier does not allow for exceptions to be throw. Using Callable therefore makes more sense.

Finally, because of type erasure, we cannot keep using a single, overloaded read variant. Instead, we should have readInputStream, readByteChannel, etc.


Affects: 5.0 GA, 5.0.1, 5.0.2

Issue Links:

  • #20922 Support Custom Headers for Multipart Async Data

Referenced from: commits 5520e73

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 19, 2018

Arjen Poutsma commented

Fixed in 5520e73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.