public class SimpleServiceRegistry extends SimpleServiceLoader implements ServiceRegistry
services| Constructor and Description |
|---|
SimpleServiceRegistry() |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
register(Class<T> service,
T implementation)
Registers a service instance.
|
<T> void |
unregister(Class<T> service,
T implementation)
Unregisters a service instance.
|
checkServicePermission, createAlternativeImplementation, getService, putServiceclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetServicepublic <T> void register(Class<T> service, T implementation)
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 ServiceRegistryT - the service type.service - the implemented service.implementation - the service instance.public <T> void unregister(Class<T> service, T implementation)
ServiceRegistryIf the given instance is not the one currently registered for the given service, nothing is done.
unregister in interface ServiceRegistryT - the service type.service - the implemented service.implementation - the service instance.