HHH-15746 Beans Helper doesn't need to be a singleton, convert to static helpers
This commit is contained in:
parent
ed52dba650
commit
7081d31647
|
@ -276,7 +276,7 @@ public class TypeDefinition implements Serializable {
|
|||
private static Object instantiateType(StandardServiceRegistry serviceRegistry,
|
||||
String name, Class<?> typeImplementorClass,
|
||||
BeanInstanceProducer instanceProducer) {
|
||||
if ( Helper.INSTANCE.shouldIgnoreBeanContainer( serviceRegistry ) ) {
|
||||
if ( Helper.shouldIgnoreBeanContainer( serviceRegistry ) ) {
|
||||
return name != null
|
||||
? instanceProducer.produceBeanInstance( name, typeImplementorClass )
|
||||
: instanceProducer.produceBeanInstance( typeImplementorClass );
|
||||
|
|
|
@ -73,7 +73,7 @@ public class StandardIdentifierGeneratorFactory
|
|||
* Constructs a new factory
|
||||
*/
|
||||
public StandardIdentifierGeneratorFactory(ServiceRegistry serviceRegistry) {
|
||||
this( serviceRegistry, Helper.INSTANCE.shouldIgnoreBeanContainer( serviceRegistry ) );
|
||||
this( serviceRegistry, Helper.shouldIgnoreBeanContainer( serviceRegistry ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ public abstract class AbstractCdiBeanContainer implements CdiBasedBeanContainer
|
|||
Class<B> beanType,
|
||||
LifecycleOptions lifecycleOptions,
|
||||
BeanInstanceProducer fallbackProducer) {
|
||||
final String beanCacheKey = Helper.INSTANCE.determineBeanCacheKey( beanType );
|
||||
final String beanCacheKey = Helper.determineBeanCacheKey( beanType );
|
||||
|
||||
final ContainedBeanImplementor existing = beanCache.get( beanCacheKey );
|
||||
if ( existing != null ) {
|
||||
|
@ -97,7 +97,7 @@ public abstract class AbstractCdiBeanContainer implements CdiBasedBeanContainer
|
|||
Class<B> beanType,
|
||||
LifecycleOptions lifecycleOptions,
|
||||
BeanInstanceProducer fallbackProducer) {
|
||||
final String beanCacheKey = Helper.INSTANCE.determineBeanCacheKey( beanName, beanType );
|
||||
final String beanCacheKey = Helper.determineBeanCacheKey( beanName, beanType );
|
||||
|
||||
final ContainedBeanImplementor existing = beanCache.get( beanCacheKey );
|
||||
if ( existing != null ) {
|
||||
|
|
|
@ -18,24 +18,20 @@ import org.hibernate.service.ServiceRegistry;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class Helper {
|
||||
/**
|
||||
* Singleton access
|
||||
*/
|
||||
public static final Helper INSTANCE = new Helper();
|
||||
public final class Helper {
|
||||
|
||||
private Helper() {
|
||||
}
|
||||
|
||||
public String determineBeanCacheKey(Class<?> beanType) {
|
||||
public static String determineBeanCacheKey(Class<?> beanType) {
|
||||
return beanType.getName();
|
||||
}
|
||||
|
||||
public String determineBeanCacheKey(String name, Class<?> beanType) {
|
||||
public static String determineBeanCacheKey(String name, Class<?> beanType) {
|
||||
return beanType.getName() + ':' + name;
|
||||
}
|
||||
|
||||
public boolean shouldIgnoreBeanContainer(ServiceRegistry serviceRegistry) {
|
||||
public static boolean shouldIgnoreBeanContainer(ServiceRegistry serviceRegistry) {
|
||||
final ConfigurationService configService = serviceRegistry.getService( ConfigurationService.class );
|
||||
final Object beanManagerRef = configService.getSettings().get( AvailableSettings.JAKARTA_CDI_BEAN_MANAGER );
|
||||
|
||||
|
@ -51,7 +47,7 @@ public class Helper {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public BeanLifecycleStrategy getLifecycleStrategy(boolean shouldRegistryManageLifecycle) {
|
||||
public static BeanLifecycleStrategy getLifecycleStrategy(boolean shouldRegistryManageLifecycle) {
|
||||
return shouldRegistryManageLifecycle
|
||||
? JpaCompliantLifecycleStrategy.INSTANCE
|
||||
: ContainerManagedLifecycleStrategy.INSTANCE;
|
||||
|
|
Loading…
Reference in New Issue