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

Make BufferRecyclerPool parameterized with type of instances pooled, to allow reuse #1114

Closed
cowtowncoder opened this issue Sep 26, 2023 · 1 comment
Labels
2.16 Issue planned (at earliest) for 2.16

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Sep 26, 2023

(note: continuation of #1064 and #1106)

As per #1064, #1106 we now have configurability for buffer recycling, usable for JSON parser/generator as well as other data formats.
However: there are some modules (Smile and Avro format modules, JAXB/Jakarta-Bind) that use old-style ThreadLocal-based non-configurable pooling.
While I tried to think of ways to perhaps extend BufferRecycler to allow for "piggy-backing" other buffers, I couldn't come up with a way that seemed Right. Instead, it seems like we should be able to reuse pool components added so far to 2.16, esp. since we can still change the API before release.

My initial thinking is that parameterizing BufferRecyclerPool with type of recycled item (in case of default impl, BufferRecycler), coupled with refactoring of the default use, would allow other modules to similarly switch to using the new pluggable mechanism. This is important since same issues wrt use of ThreadLocal affect those modules and it seems pointless to copy all (or parts) of code here.

Having said that, addition of type parameters may be cumbersome. But I think it is doable.

And I think it's important to get it in 2.16, if at all possible, so API doesn't need to change in future.

@cowtowncoder cowtowncoder added the 2.16 Issue planned (at earliest) for 2.16 label Sep 26, 2023
@cowtowncoder
Copy link
Member Author

/cc @mariofusco @pjfanning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.16 Issue planned (at earliest) for 2.16
Projects
None yet
Development

No branches or pull requests

1 participant