eclipse-ee4j / yasson

Eclipse Yasson project
https://projects.eclipse.org/projects/ee4j.yasson
Other
204 stars 96 forks source link

Keep streams in JsonBinding open #631

Open marschall opened 1 year ago

marschall commented 1 year ago

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

marschall commented 1 year ago

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.

jamezp commented 3 months ago

Is there any update on what should happen here?

marschall commented 3 months ago

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