jrte / ribose

Sugar for building and running context-free transducers in Java
GNU General Public License v3.0
3 stars 2 forks source link

Use a ThreadLocal<Codec> variable to contain charset codecs #36

Closed jrte closed 1 year ago

jrte commented 1 year ago

Charset codecs are used throughout ribose code. Storing them in a ThreadLocal<Codec> on first use allows them to be accessed anywhere. IModel.close() implementations detach the ThreadLocal<Codec> instance from the calling thread. But threads that do not directly or indirectly (try-with-resources) call IModel.close()call the static IModel.detach() method to rid themselves of the thread local Codec instance.

jrte commented 1 year ago

Fix is implemented in commit f83daba. There are interface changes:

jrte commented 1 year ago

Fixed in 87f6054.