Class BootstrapServiceRegistryImpl
- java.lang.Object
-
- org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl
-
- All Implemented Interfaces:
AutoCloseable
,BootstrapServiceRegistry
,ServiceRegistry
,ServiceBinding.ServiceLifecycleOwner
,ServiceRegistryImplementor
public class BootstrapServiceRegistryImpl extends Object implements ServiceRegistryImplementor, BootstrapServiceRegistry, ServiceBinding.ServiceLifecycleOwner
ServiceRegistry
implementation containing specialized "bootstrap" services, specifically:
-
-
Constructor Summary
Constructors Constructor Description BootstrapServiceRegistryImpl()
Constructs a BootstrapServiceRegistryImpl.BootstrapServiceRegistryImpl(boolean autoCloseRegistry, ClassLoaderService classLoaderService, LinkedHashSet<Integrator> providedIntegrators)
Constructs a BootstrapServiceRegistryImpl.BootstrapServiceRegistryImpl(boolean autoCloseRegistry, ClassLoaderService classLoaderService, StrategySelector strategySelector, IntegratorService integratorService)
Constructs a BootstrapServiceRegistryImpl.BootstrapServiceRegistryImpl(ClassLoaderService classLoaderService, LinkedHashSet<Integrator> providedIntegrators)
Constructs a BootstrapServiceRegistryImpl.BootstrapServiceRegistryImpl(ClassLoaderService classLoaderService, StrategySelector strategySelector, IntegratorService integratorService)
Constructs a BootstrapServiceRegistryImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R extends Service>
voidconfigureService(ServiceBinding<R> binding)
void
deRegisterChild(ServiceRegistryImplementor child)
When a registry is created with a parent, the parent is notified of the child via this callback.void
destroy()
Release resources<T extends Service>
TfromRegistryOrChildren(Class<T> serviceRole)
@Nullable ServiceRegistry
getParentServiceRegistry()
Retrieve this registry's parent registry.<R extends Service>
@Nullable RgetService(Class<R> serviceRole)
Retrieve a service by role, returning null if there is no such service.<R extends Service>
RinitiateService(ServiceInitiator<R> serviceInitiator)
<R extends Service>
voidinjectDependencies(ServiceBinding<R> binding)
boolean
isActive()
<R extends Service>
ServiceBinding<R>locateServiceBinding(Class<R> serviceRole)
Locate the binding for the given role.void
registerChild(ServiceRegistryImplementor child)
When a registry is created with a parent, the parent is notified of the child via this callback.<R extends Service>
voidstartService(ServiceBinding<R> binding)
<R extends Service>
voidstopService(ServiceBinding<R> binding)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.service.ServiceRegistry
requireService
-
Methods inherited from interface org.hibernate.service.spi.ServiceRegistryImplementor
close
-
-
-
-
Constructor Detail
-
BootstrapServiceRegistryImpl
public BootstrapServiceRegistryImpl()
Constructs a BootstrapServiceRegistryImpl. Do not use directly generally speaking. UseBootstrapServiceRegistryBuilder
instead.- See Also:
BootstrapServiceRegistryBuilder
-
BootstrapServiceRegistryImpl
public BootstrapServiceRegistryImpl(ClassLoaderService classLoaderService, LinkedHashSet<Integrator> providedIntegrators)
Constructs a BootstrapServiceRegistryImpl. Do not use directly generally speaking. UseBootstrapServiceRegistryBuilder
instead.- Parameters:
classLoaderService
- The ClassLoaderService to useprovidedIntegrators
- The group of explicitly provided integrators- See Also:
BootstrapServiceRegistryBuilder
-
BootstrapServiceRegistryImpl
public BootstrapServiceRegistryImpl(boolean autoCloseRegistry, ClassLoaderService classLoaderService, LinkedHashSet<Integrator> providedIntegrators)
Constructs a BootstrapServiceRegistryImpl. Do not use directly generally speaking. UseBootstrapServiceRegistryBuilder
instead.- Parameters:
autoCloseRegistry
- See discussion onBootstrapServiceRegistryBuilder.disableAutoClose()
classLoaderService
- The ClassLoaderService to useprovidedIntegrators
- The group of explicitly provided integrators- See Also:
BootstrapServiceRegistryBuilder
-
BootstrapServiceRegistryImpl
public BootstrapServiceRegistryImpl(ClassLoaderService classLoaderService, StrategySelector strategySelector, IntegratorService integratorService)
Constructs a BootstrapServiceRegistryImpl. Do not use directly generally speaking. UseBootstrapServiceRegistryBuilder
instead.- Parameters:
classLoaderService
- The ClassLoaderService to usestrategySelector
- The StrategySelector to useintegratorService
- The IntegratorService to use- See Also:
BootstrapServiceRegistryBuilder
-
BootstrapServiceRegistryImpl
public BootstrapServiceRegistryImpl(boolean autoCloseRegistry, ClassLoaderService classLoaderService, StrategySelector strategySelector, IntegratorService integratorService)
Constructs a BootstrapServiceRegistryImpl. Do not use directly generally speaking. UseBootstrapServiceRegistryBuilder
instead.- Parameters:
autoCloseRegistry
- See discussion onBootstrapServiceRegistryBuilder.disableAutoClose()
classLoaderService
- The ClassLoaderService to usestrategySelector
- The StrategySelector to useintegratorService
- The IntegratorService to use- See Also:
BootstrapServiceRegistryBuilder
-
-
Method Detail
-
getService
public <R extends Service> @Nullable R getService(Class<R> serviceRole)
Description copied from interface:ServiceRegistry
Retrieve a service by role, returning null if there is no such service. If service is not found, but aServiceInitiator
is registered for this service role, the service will be initialized and returned. Most of the time, use ofServiceRegistry.requireService(Class)
is preferred, being much less likely to cause aNullPointerException
in the client.- Specified by:
getService
in interfaceServiceRegistry
- Type Parameters:
R
- The service role type- Parameters:
serviceRole
- The service role- Returns:
- The requested service or null if the service was not found.
-
locateServiceBinding
public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole)
Description copied from interface:ServiceRegistryImplementor
Locate the binding for the given role. Should, generally speaking, look into parent registry if one.- Specified by:
locateServiceBinding
in interfaceServiceRegistryImplementor
- Type Parameters:
R
- generic return type.- Parameters:
serviceRole
- The service role for which to locate a binding.- Returns:
- The located binding; may be
null
-
destroy
public void destroy()
Description copied from interface:ServiceRegistryImplementor
Release resources- Specified by:
destroy
in interfaceServiceRegistryImplementor
-
isActive
public boolean isActive()
-
getParentServiceRegistry
public @Nullable ServiceRegistry getParentServiceRegistry()
Description copied from interface:ServiceRegistry
Retrieve this registry's parent registry.- Specified by:
getParentServiceRegistry
in interfaceServiceRegistry
- Returns:
- The parent registry. May be null.
-
initiateService
public <R extends Service> R initiateService(ServiceInitiator<R> serviceInitiator)
- Specified by:
initiateService
in interfaceServiceBinding.ServiceLifecycleOwner
-
configureService
public <R extends Service> void configureService(ServiceBinding<R> binding)
- Specified by:
configureService
in interfaceServiceBinding.ServiceLifecycleOwner
-
injectDependencies
public <R extends Service> void injectDependencies(ServiceBinding<R> binding)
- Specified by:
injectDependencies
in interfaceServiceBinding.ServiceLifecycleOwner
-
startService
public <R extends Service> void startService(ServiceBinding<R> binding)
- Specified by:
startService
in interfaceServiceBinding.ServiceLifecycleOwner
-
stopService
public <R extends Service> void stopService(ServiceBinding<R> binding)
- Specified by:
stopService
in interfaceServiceBinding.ServiceLifecycleOwner
-
registerChild
public void registerChild(ServiceRegistryImplementor child)
Description copied from interface:ServiceRegistryImplementor
When a registry is created with a parent, the parent is notified of the child via this callback.- Specified by:
registerChild
in interfaceServiceRegistryImplementor
-
deRegisterChild
public void deRegisterChild(ServiceRegistryImplementor child)
Description copied from interface:ServiceRegistryImplementor
When a registry is created with a parent, the parent is notified of the child via this callback.- Specified by:
deRegisterChild
in interfaceServiceRegistryImplementor
-
fromRegistryOrChildren
public <T extends Service> T fromRegistryOrChildren(Class<T> serviceRole)
- Specified by:
fromRegistryOrChildren
in interfaceServiceRegistryImplementor
-
-