HHH-6258: Cached JdbcServices and Dialect in local variables to lessen load on AbtractServiceRegistryImpl.localServiceBinding(java.lang.Class). This improved throughput.

This commit is contained in:
Andrig Miller 2011-05-25 17:35:07 -06:00 committed by Steve Ebersole
parent abe51d5b35
commit a917bb4b40
1 changed files with 8 additions and 3 deletions

View File

@ -189,6 +189,8 @@ public final class SessionFactoryImpl
private final transient Map fetchProfiles;
private final transient Map<String,String> imports;
private final transient SessionFactoryServiceRegistry serviceRegistry;
private final transient JdbcServices jdbcServices;
private final transient Dialect dialect;
private final transient Settings settings;
private final transient Properties properties;
private transient SchemaExport schemaExport;
@ -252,6 +254,8 @@ public final class SessionFactoryImpl
this,
cfg
);
this.jdbcServices = this.serviceRegistry.getService( JdbcServices );
this.dialect = this.jdbcServices.getDialect();
this.sqlFunctionRegistry = new SQLFunctionRegistry( getDialect(), cfg.getSqlFunctions() );
if ( observer != null ) {
this.observer.addObserver( observer );
@ -965,14 +969,15 @@ public final class SessionFactoryImpl
}
public JdbcServices getJdbcServices() {
return serviceRegistry.getService( JdbcServices.class );
return jdbcServices;
}
public Dialect getDialect() {
if ( serviceRegistry == null ) {
throw new IllegalStateException( "Cannot determine dialect because serviceRegistry is null." );
}
return getJdbcServices().getDialect();
return dialect;
//return getJdbcServices().getDialect();
}
public Interceptor getInterceptor()
@ -1159,7 +1164,7 @@ public final class SessionFactoryImpl
}
public ConnectionProvider getConnectionProvider() {
return serviceRegistry.getService( JdbcServices.class ).getConnectionProvider();
return jdbcServices.getConnectionProvider();
}
/**