HHH-10427 Binding to alternative implementations need to be a final field

This commit is contained in:
Sanne Grinovero 2016-06-03 17:49:32 +01:00 committed by Steve Ebersole
parent 9ecc646df2
commit 5a3260fb02
1 changed files with 4 additions and 9 deletions

View File

@ -48,7 +48,7 @@ public abstract class AbstractServiceRegistryImpl
private final boolean allowCrawling;
private final ConcurrentServiceBinding<Class,ServiceBinding> serviceBindingMap = new ConcurrentServiceBinding<Class,ServiceBinding>();
private ConcurrentServiceBinding<Class,Class> roleXref;
private final ConcurrentServiceBinding<Class,Class> roleXref = new ConcurrentServiceBinding<Class,Class>();
// The services stored in initializedServiceByRole are completely initialized
// (i.e., configured, dependencies injected, and started)
private final ConcurrentServiceBinding<Class,Service> initializedServiceByRole = new ConcurrentServiceBinding<Class, Service>();
@ -146,11 +146,9 @@ public abstract class AbstractServiceRegistryImpl
}
// look for a previously resolved alternate registration
if ( roleXref != null ) {
final Class alternative = roleXref.get( serviceRole );
if ( alternative != null ) {
return serviceBindingMap.get( alternative );
}
final Class alternative = roleXref.get( serviceRole );
if ( alternative != null ) {
return serviceBindingMap.get( alternative );
}
// perform a crawl looking for an alternate registration
@ -174,9 +172,6 @@ public abstract class AbstractServiceRegistryImpl
}
private void registerAlternate(Class alternate, Class target) {
if ( roleXref == null ) {
roleXref = new ConcurrentServiceBinding<Class,Class>();
}
roleXref.put( alternate, target );
}