HHH-10427 - Fix ServiceRegistry creates multiple service instances and returns uninitialized services
This commit is contained in:
parent
493793a299
commit
c1fde98aee
|
@ -183,7 +183,7 @@ public abstract class AbstractServiceRegistryImpl
|
||||||
if ( serviceBinding == null ) {
|
if ( serviceBinding == null ) {
|
||||||
throw new UnknownServiceException( serviceRole );
|
throw new UnknownServiceException( serviceRole );
|
||||||
}
|
}
|
||||||
|
synchronized (this) {
|
||||||
R service = serviceBinding.getService();
|
R service = serviceBinding.getService();
|
||||||
if ( service == null ) {
|
if ( service == null ) {
|
||||||
service = initializeService( serviceBinding );
|
service = initializeService( serviceBinding );
|
||||||
|
@ -191,6 +191,7 @@ public abstract class AbstractServiceRegistryImpl
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected <R extends Service> void registerService(ServiceBinding<R> serviceBinding, R service) {
|
protected <R extends Service> void registerService(ServiceBinding<R> serviceBinding, R service) {
|
||||||
serviceBinding.setService( service );
|
serviceBinding.setService( service );
|
||||||
|
|
Loading…
Reference in New Issue