The methods in Json use JsonProvider.provider() and this re-creates the JsonProvider on each execution.
The javadoc for JsonProvider.provider() suggests that the caller should cache the resulting JsonProvider and jakarta.json.Json does not do this, so I think this is a bug.
For example, in Json we see:
/**
* ...
*/
public static JsonParser createParser(Reader reader) {
return JsonProvider.provider().createParser(reader);
}
/**
* ...
*/
public static JsonParser createParser(InputStream in) {
return JsonProvider.provider().createParser(in);
}
In the javadoc for JsonProvider.provider() is says:
"Creates a JSON provider object. ... Users are recommended to cache the result of this method."
I believe that means that Json should be changed to indeed cache the result of JsonProvider.provider().