-
-
Notifications
You must be signed in to change notification settings - Fork 818
Description
(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.