apache / jena

Apache Jena
https://jena.apache.org/
Apache License 2.0
1.12k stars 653 forks source link

GH-2795: Fix race condition in datatype registration #2796

Closed Ostrzyciel closed 1 month ago

Ostrzyciel commented 1 month ago

GitHub issue resolved #2795

Pull request Description:

Fixed a race condition in user-defined datatype registration. This change only touches the user-friendly getSafeTypeByName and does not change anything from the user's perspective (other than fixing the race condition). The registerDatatype method is left as-is, to allow for overriding datatype registrations if someone really wants to.

I've added some notes to registerDatatype and unregisterDatatype that it they have good "shoot-yourself-in-the-foot-with-a-bazooka" potential.


By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

arne-bdt commented 1 month ago

I don´t think, this is the way to solve the issue. --> discussion in https://github.com/apache/jena/issues/2795#issuecomment-2439653100

Ostrzyciel commented 1 month ago

Updated the PR with a different approach as per the discussion in the issue #2795