public class FileSystemServiceDiscovery extends AbstractServiceDiscovery implements EventListener<ServiceInstancesChangedEvent>
ServiceDiscovery implementationFileSystemDynamicConfigurationCOMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY| Constructor and Description |
|---|
FileSystemServiceDiscovery() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the
ServiceDiscovery |
void |
doRegister(ServiceInstance serviceInstance)
It should be implement in kinds of service discovers.
|
void |
doUpdate(ServiceInstance serviceInstance)
It should be implement in kinds of service discovers.
|
List<ServiceInstance> |
getInstances(String serviceName)
Gets all
service instances by the specified service name. |
Set<String> |
getServices()
Gets all service names
|
URL |
getUrl() |
void |
initialize(URL registryURL)
Initializes the
ServiceDiscovery |
void |
onConfigChanged(ConfigChangedEvent event) |
void |
onEvent(ServiceInstancesChangedEvent event) |
void |
unregister(ServiceInstance serviceInstance)
Unregisters an instance of
ServiceInstance. |
getLocalInstance, register, updateequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindEventType, findEventType, findEventType, getPrioritycompareToaddServiceInstancesChangedListener, dispatchServiceInstancesChangedEvent, dispatchServiceInstancesChangedEvent, dispatchServiceInstancesChangedEvent, dispatchServiceInstancesChangedEvent, getDefaultPageSize, getInstances, getInstances, getInstances, removeServiceInstancesChangedListener, toStringpublic void onEvent(ServiceInstancesChangedEvent event)
public void initialize(URL registryURL) throws Exception
ServiceDiscoveryServiceDiscoveryinitialize in interface ServiceDiscoveryregistryURL - the url to connect service registryException - If met with errorpublic void onConfigChanged(ConfigChangedEvent event)
public void destroy()
throws Exception
ServiceDiscoveryServiceDiscoverydestroy in interface ServiceDiscoveryException - If met with errorpublic List<ServiceInstance> getInstances(String serviceName)
ServiceDiscoveryservice instances by the specified service name.getInstances in interface ServiceDiscoveryserviceName - the service nameListpublic URL getUrl()
getUrl in interface ServiceDiscoverypublic void doRegister(ServiceInstance serviceInstance)
AbstractServiceDiscoverydoRegister in class AbstractServiceDiscoverypublic void doUpdate(ServiceInstance serviceInstance)
AbstractServiceDiscoverydoUpdate in class AbstractServiceDiscoverypublic void unregister(ServiceInstance serviceInstance) throws RuntimeException
ServiceDiscoveryServiceInstance.unregister in interface ServiceDiscoveryserviceInstance - an instance of ServiceInstance to be unregisteredRuntimeException - if failedpublic Set<String> getServices()
ServiceDiscoverygetServices in interface ServiceDiscoverySetCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.