public class ServiceRegistryKF extends SimpleServiceRegistry implements ServiceRegistry
services| Constructor and Description |
|---|
ServiceRegistryKF()
Instantiates a new service registry KF.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getService(Class<T> service)
Gets the instance of the given service.
|
<T> void |
register(Class<T> service,
T instance)
Registers a service instance.
|
<T> void |
register(Class<T> service,
T instance,
boolean isKernelLocal)
Registers a Service Instance for the Kernel.
|
<T> void |
unregister(Class<T> service,
T instance)
Unregisters a service instance.
|
<T> void |
unregister(Class<T> service,
T instance,
boolean isKernelLocal)
Unregisters a Service Instance from the Kernel.
|
checkServicePermission, createAlternativeImplementation, putServicepublic ServiceRegistryKF()
public <T> T getService(Class<T> service)
ServiceLoaderIf there is already an instance in cache, it is returned otherwise a new one is created.
May return null if the service is not defined.
getService in interface ServiceLoadergetService in class SimpleServiceLoaderT - the service type.service - the service.public <T> void register(Class<T> service, T instance)
ServiceRegistry
The given instance is returned each time the service is requested by ServiceLoader.getService(Class).
If the service already has a registered instance, the previous one is replaced.
register in interface ServiceRegistryregister in class SimpleServiceRegistryT - the service type.service - the implemented service.instance - the service instance.public <T> void register(Class<T> service, T instance, boolean isKernelLocal)
service - the class type of the serviceinstance - the instance of the serviceisKernelLocal - if the service should be stored in the local context of the Kernel or shared with other featurespublic <T> void unregister(Class<T> service, T instance)
ServiceRegistryIf the given instance is not the one currently registered for the given service, nothing is done.
unregister in interface ServiceRegistryunregister in class SimpleServiceRegistryT - the service type.service - the implemented service.instance - the service instance.public <T> void unregister(Class<T> service, T instance, boolean isKernelLocal)
service - the class type of the serviceinstance - the instance of the serviceisKernelLocal - if the service should be removed from the local context of the Kernel or shared with other features