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

Keep streams in JsonBinding open #631

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marschall
Copy link
Contributor

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

@marschall
Copy link
Contributor Author

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 jakartaee/jsonb-api#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
Copy link

jamezp commented Aug 13, 2024

Is there any update on what should happen here?

@marschall
Copy link
Contributor Author

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

Keep the streams in JsonBinding open but close the parsers and
generators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants