HHH-12894 Simplify code of StandardSessionFactoryServiceInitiators

This commit is contained in:
Sanne Grinovero 2018-08-08 10:57:04 +01:00
parent 8a8685d98e
commit fa5f592fb9
2 changed files with 5 additions and 18 deletions

View File

@ -24,24 +24,13 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistryBuilder;
public class SessionFactoryServiceRegistryBuilderImpl implements SessionFactoryServiceRegistryBuilder {
private final ServiceRegistryImplementor parent;
private final List<SessionFactoryServiceInitiator> initiators = standardInitiatorList();
private final List<SessionFactoryServiceInitiator> initiators = StandardSessionFactoryServiceInitiators.buildStandardServiceInitiatorList();
private final List<ProvidedService> providedServices = new ArrayList<>();
public SessionFactoryServiceRegistryBuilderImpl(ServiceRegistryImplementor parent) {
this.parent = parent;
}
/**
* Used from the {@link #initiators} variable initializer
*
* @return List of standard initiators
*/
private static List<SessionFactoryServiceInitiator> standardInitiatorList() {
final List<SessionFactoryServiceInitiator> initiators = new ArrayList<>();
initiators.addAll( StandardSessionFactoryServiceInitiators.LIST );
return initiators;
}
/**
* Adds a service initiator.
*

View File

@ -22,19 +22,17 @@ import org.hibernate.stat.internal.StatisticsInitiator;
*
* @author Steve Ebersole
*/
public class StandardSessionFactoryServiceInitiators {
public static List<SessionFactoryServiceInitiator> LIST = buildStandardServiceInitiatorList();
public final class StandardSessionFactoryServiceInitiators {
private static List<SessionFactoryServiceInitiator> buildStandardServiceInitiatorList() {
final List<SessionFactoryServiceInitiator> serviceInitiators = new ArrayList<>();
public static List<SessionFactoryServiceInitiator> buildStandardServiceInitiatorList() {
final ArrayList<SessionFactoryServiceInitiator> serviceInitiators = new ArrayList<>();
serviceInitiators.add( EventListenerServiceInitiator.INSTANCE );
serviceInitiators.add( StatisticsInitiator.INSTANCE );
serviceInitiators.add( CacheInitiator.INSTANCE );
serviceInitiators.add( NativeQueryInterpreterInitiator.INSTANCE );
return Collections.unmodifiableList( serviceInitiators );
return serviceInitiators;
}
private StandardSessionFactoryServiceInitiators() {