yasson icon indicating copy to clipboard operation
yasson copied to clipboard

Keep streams in JsonBinding open

Open marschall opened this issue 2 years ago • 3 comments

Keep the streams in JsonBinding open but close the parsers and generators.

marschall avatar Dec 01 '23 09:12 marschall

This restores the old behaviour before #586 but closes the parsers and generators with will cause the buffers to be returned to the pool. This behaviour is currently not spec compliant for the InputStream methods. However an issue is open against the specification to change the specification, making this behaviour spec compliant see https://github.com/jakartaee/jsonb-api/issues/346

I keep closing the parsers and in order to fix the original issue, buffers not being recycled. Only when I close the parsers and generators will JsonGeneratorImpl.close() and JsonTokenizer.close() be called which will then call BufferPool.recycle(char[]). Since Yasson depends on the JSON-P API I found no way to make a parser return the buffer to the pool without calling close, or closing them to return the buffer to the pool but keep the streams open. I therefore saw no alternative other than to wrap the streams. I chose to delegate all methods and not rely on superclass defined methods.

marschall avatar Dec 01 '23 10:12 marschall

Is there any update on what should happen here?

jamezp avatar Aug 13 '24 14:08 jamezp

Is there any update on what should happen here?

Unfortunately I can not provide an update to you as I'm not affiliated with the project. I would appreciate such an update as well.

I rebased the changes to solve the merge conflicts, now however the tests fail with

Copyright year is wrong; is 2024, should be 2023 COPYRIGHT ERROR

I'll have to have a look at etc/copyright.sh

marschall avatar Aug 17 '24 14:08 marschall