Service creation in the ServiceRegistry does not seem to be thread safe. When a service is requested for the first time, an instance is created by the registry, registered and then initialized. When multiple threads request the service for the first time,
- the service instance might get created multiple times and
- some of the threads may receive the a registered, but not yet initialized service instance
We created a test case for this on GitHub: https://github.com/abenneke/sandbox/tree/master/hibernate-registry Please note that the number of threads in those tests are rather high to increase the probability for the errors to occur. |