Removed deprecated SessionFactoryServiceInitiator.initiateService(SessionFactoryImplementor, SessionFactoryOptions, ServiceRegistryImplementor)

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2022-03-07 23:48:32 +01:00 committed by Steve Ebersole
parent b1ec3ab78b
commit 8e068d7647
4 changed files with 6 additions and 62 deletions

View File

@ -6,10 +6,7 @@
*/
package org.hibernate.engine.query.spi;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.engine.query.internal.NativeQueryInterpreterStandardImpl;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.service.spi.SessionFactoryServiceInitiator;
import org.hibernate.service.spi.SessionFactoryServiceInitiatorContext;
@ -22,14 +19,6 @@ public class NativeQueryInterpreterInitiator implements SessionFactoryServiceIni
*/
public static final NativeQueryInterpreterInitiator INSTANCE = new NativeQueryInterpreterInitiator();
@Override
public NativeQueryInterpreter initiateService(
SessionFactoryImplementor sessionFactory,
SessionFactoryOptions sessionFactoryOptions,
ServiceRegistryImplementor registry) {
return new NativeQueryInterpreterStandardImpl();
}
@Override
public NativeQueryInterpreter initiateService(SessionFactoryServiceInitiatorContext context) {
return new NativeQueryInterpreterStandardImpl();

View File

@ -6,14 +6,13 @@
*/
package org.hibernate.engine.spi;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cache.internal.DisabledCaching;
import org.hibernate.cache.internal.EnabledCaching;
import org.hibernate.cache.internal.NoCachingRegionFactory;
import org.hibernate.cache.spi.CacheImplementor;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.service.spi.SessionFactoryServiceInitiator;
import org.hibernate.service.spi.SessionFactoryServiceInitiatorContext;
/**
* Initiator for second level cache support
@ -25,14 +24,11 @@ public class CacheInitiator implements SessionFactoryServiceInitiator<CacheImple
public static final CacheInitiator INSTANCE = new CacheInitiator();
@Override
public CacheImplementor initiateService(
SessionFactoryImplementor sessionFactory,
SessionFactoryOptions sessionFactoryOptions,
ServiceRegistryImplementor registry) {
final RegionFactory regionFactory = registry.getService( RegionFactory.class );
public CacheImplementor initiateService(SessionFactoryServiceInitiatorContext context) {
final RegionFactory regionFactory = context.getServiceRegistry().getService( RegionFactory.class );
return ( ! NoCachingRegionFactory.class.isInstance( regionFactory ) )
? new EnabledCaching( sessionFactory )
: new DisabledCaching( sessionFactory );
? new EnabledCaching( context.getSessionFactory() )
: new DisabledCaching( context.getSessionFactory() );
}
@Override

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.service.spi;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.service.Service;
/**
@ -26,31 +24,5 @@ public interface SessionFactoryServiceInitiator<R extends Service> extends Servi
*
* @return The initiated service.
*/
default R initiateService(SessionFactoryServiceInitiatorContext context) {
return initiateService(
context.getSessionFactory(),
context.getSessionFactoryOptions(),
context.getServiceRegistry()
);
}
/**
* Initiates the managed service.
* <p/>
* Note for implementors: signature is guaranteed to change once redesign of SessionFactory building is complete
*
* @param sessionFactory The session factory. Note the session factory is still in flux; care needs to be taken
* regarding what you call.
* @param sessionFactoryOptions Options specified for building the SessionFactory
* @param registry The service registry. Can be used to locate services needed to fulfill initiation.
*
* @return The initiated service.
*
* @deprecated Use {@link SessionFactoryServiceInitiator#initiateService(SessionFactoryServiceInitiatorContext)} instead.
*/
@Deprecated
R initiateService(
SessionFactoryImplementor sessionFactory,
SessionFactoryOptions sessionFactoryOptions,
ServiceRegistryImplementor registry);
R initiateService(SessionFactoryServiceInitiatorContext context);
}

View File

@ -8,7 +8,6 @@ package org.hibernate.stat.internal;
import org.hibernate.HibernateException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.CoreMessageLogger;
@ -48,18 +47,6 @@ public class StatisticsInitiator implements SessionFactoryServiceInitiator<Stati
return initiateServiceInternal( context.getSessionFactory(), configValue, context.getServiceRegistry() );
}
@Override
public StatisticsImplementor initiateService(
SessionFactoryImplementor sessionFactory,
SessionFactoryOptions sessionFactoryOptions,
ServiceRegistryImplementor registry) {
final Object configValue = registry
.getService( ConfigurationService.class )
.getSettings()
.get( STATS_BUILDER );
return initiateServiceInternal( sessionFactory, configValue, registry );
}
private StatisticsImplementor initiateServiceInternal(
SessionFactoryImplementor sessionFactory,
Object configValue,