move pool reference from BufferRecycler to IOContext #1107
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an alternative solution for the problem reported and tentatively fixed here.
This time I moved the pool reference from the
BufferRecycler
to theIOContext
instance. In this way I got rid of thatwithPool
method and now it'sIOContext
responsibility to pass to theBufferRecycler
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 theBufferRecycler
is always exclusively used by theIOContext
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).