public class DefaultServiceRegistry extends Object implements ServiceRegistry, DefaultServiceRegistryMBean
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultServiceRegistry.ServiceEndpointState |
| Constructor and Description |
|---|
DefaultServiceRegistry() |
| Modifier and Type | Method and Description |
|---|---|
<SERVICE_INTERFACE> |
addService(Class<SERVICE_INTERFACE> serviceInterface,
SERVICE_INTERFACE serviceInstance)
Adds the given service using the fully qualified class name of the serviceInterface as service endpoint id.
|
<SERVICE_INTERFACE> |
addService(String serviceEndpointId,
Class<SERVICE_INTERFACE> serviceInterface,
SERVICE_INTERFACE serviceInstance) |
protected <SERVICE_INTERFACE> |
createServiceProxy(DefaultServiceRegistry.ServiceEndpointState serviceEndpointState,
Class<SERVICE_INTERFACE> serviceInterface)
This method is intended for sub-classing
|
List<ServiceEndpoint> |
getActiveServiceEndpoints()
This method is intended for troubleshooting/debugging purposes only
|
<SERVICE_INTERFACE> |
getService(String serviceEndpointId,
Class<SERVICE_INTERFACE> serviceInterface) |
Set<String> |
getServiceEndpointIds() |
protected int |
getServiceEndpointsCount()
for testing garbage collection
|
void |
registerAsMBean(MBeanServer mbeanServer,
String mbeanName) |
boolean |
removeService(String serviceEndpointId,
Object serviceInstance) |
public <SERVICE_INTERFACE> boolean addService(Class<SERVICE_INTERFACE> serviceInterface, SERVICE_INTERFACE serviceInstance) throws IllegalArgumentException, IllegalStateException
ServiceRegistryaddService in interface ServiceRegistrytrue if the serviceInstance was added, false if the serviceInstance was added alreadyIllegalStateException - if another service was already registered for the given service IdIllegalArgumentExceptionpublic <SERVICE_INTERFACE> boolean addService(String serviceEndpointId, Class<SERVICE_INTERFACE> serviceInterface, SERVICE_INTERFACE serviceInstance) throws IllegalArgumentException, IllegalStateException
addService in interface ServiceRegistrytrue if the serviceInstance was added, false if the serviceInstance was added alreadyIllegalArgumentException - if serviceEndpointId == null or serviceInstance == nullIllegalStateException - if another service was already registered for the given service Idprotected <SERVICE_INTERFACE> ServiceProxyInternal<SERVICE_INTERFACE> createServiceProxy(DefaultServiceRegistry.ServiceEndpointState serviceEndpointState, Class<SERVICE_INTERFACE> serviceInterface)
public List<ServiceEndpoint> getActiveServiceEndpoints()
ServiceRegistrygetActiveServiceEndpoints in interface ServiceRegistrypublic <SERVICE_INTERFACE> ServiceProxy<SERVICE_INTERFACE> getService(String serviceEndpointId, Class<SERVICE_INTERFACE> serviceInterface)
getService in interface ServiceRegistrypublic Set<String> getServiceEndpointIds()
getServiceEndpointIds in interface DefaultServiceRegistryMBeanprotected int getServiceEndpointsCount()
public void registerAsMBean(MBeanServer mbeanServer, String mbeanName)
mbeanServer - if null, the platform mbeanServer is usedmbeanName - if null, an mbean name based on the package and class name of the registry is usedpublic boolean removeService(String serviceEndpointId, Object serviceInstance) throws IllegalArgumentException
removeService in interface ServiceRegistrytrue if the serviceInstance was removed successfully, false if the given serviceInstance was not registeredIllegalArgumentException - if serviceEndpointId == null or serviceInstance == nullCopyright © 2010–2021 Vegard IT GmbH, Germany. All rights reserved.