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

move pool reference from BufferRecycler to IOContext #1107

Closed
wants to merge 2 commits into from

Conversation

mariofusco
Copy link
Contributor

@mariofusco mariofusco commented Sep 12, 2023

This is an alternative solution for the problem reported and tentatively fixed here.

This time I moved the pool reference from the BufferRecycler to the IOContext instance. In this way I got rid of that withPool method and now it's IOContext responsibility to pass to the BufferRecycler the instance of the pool to which it has to be eventually released.

This solution has the advantage of exposing a much cleaner API, but the drawback of moving the pool reference away from its own BufferRecycler. I think that this is fine as long as the BufferRecycler is always exclusively used by the IOContext and there aren't other classes that reference it either now or in future.

@cowtowncoder @pjfanning Please let me know if this solution is more acceptable than the one that I proposed yesterday (I believe so).

return new IOContext(_streamReadConstraints, _streamWriteConstraints, _errorReportConfiguration,
_getBufferRecycler(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alas, I don't like this, due to backwards-(in)compatibility aspect -- this will immediately break usage by those JsonFactory sub-classes that override this method (I think CSV one does, probably others).
Or rather, require synchronized changes (technically allowed as per my "internal vs external" compatibility goals.. as long as all 2.16 components work together).

@cowtowncoder
Copy link
Member

I actually prefer the other approach, even if at some point I was thinking that maybe IOContext should handle pool/recycler interaction.

Will add a note on the other PR.

@mariofusco
Copy link
Contributor Author

We preferred and found an agreement on the other solution.

@mariofusco mariofusco closed this Sep 13, 2023
@mariofusco mariofusco deleted the pluggable_pool_2 branch September 13, 2023 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants