You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
the reason here was problematic caching in server environment. EE compliant server must provide some implementation which is typically loaded by bootstrap/server root classloader but also allow usage of different implementation which may be part of some web application (thus loaded by webapp classloader).
So is this saying that jakarta.json.Json is loaded by the bootstrap/server root classloader, and hence on per webapp basis each webapp can't then use it's own potentially different provider. The net effect is that jakarta.json.Json can't cache the provider as it is per EE container.
Ok, I think I see that. My initial thought is that it seems that could be fixable by using a well known system property that EE servers would set (or anyone that wants this existing behavior). That is, EE compliant server sets a well known system property that effectively keep this existing behavior and the absence of that system property for non-EE, microservices style, everyone else etc JsonProvider.provider() only initialises the provider once.
Something like:
Not this PR, leave jakarta.json.Json as it is calling JsonProvider.provider()
Modify JsonProvider.provider() to do existing behavior (in the presence of a well known system property that EE servers set) and otherwise only initialise a JsonProvider once and cache it in JsonProvider.
Did I miss the issue / problem?
Does the approach of using a well known system property sound ok?
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 resultingJsonProvider
andjakarta.json.Json
does not do this, so I think this is a bug.For example, in Json we see:
In the javadoc for
JsonProvider.provider()
is says:I believe that means that
Json
should be changed to indeed cache the result ofJsonProvider.provider()
.The text was updated successfully, but these errors were encountered: