类 ConsulServiceDiscovery
- java.lang.Object
-
- org.apache.dubbo.registry.client.AbstractServiceDiscovery
-
- org.apache.dubbo.registry.consul.ConsulServiceDiscovery
-
- 所有已实现的接口:
Comparable<Prioritized>,EventListener,Prioritized,EventListener<ServiceInstancesChangedEvent>,ServiceDiscovery
public class ConsulServiceDiscovery extends AbstractServiceDiscovery implements EventListener<ServiceInstancesChangedEvent>
2019-07-31
-
-
字段概要
-
从接口继承的字段 org.apache.dubbo.common.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
构造器概要
构造器 构造器 说明 ConsulServiceDiscovery()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddServiceInstancesChangedListener(ServiceInstancesChangedListener listener)Add an instance ofServiceInstancesChangedListenerfor specified servicevoiddestroy()Destroy theServiceDiscoveryvoiddoRegister(ServiceInstance serviceInstance)It should be implement in kinds of service discovers.voiddoUpdate(ServiceInstance serviceInstance)It should be implement in kinds of service discovers.List<ServiceInstance>getInstances(String serviceName)Gets allservice instancesby the specified service name.Set<String>getServices()Gets all service namesURLgetUrl()voidinitialize(URL registryURL)Initializes theServiceDiscoveryvoidonEvent(ServiceInstancesChangedEvent event)Handle aDubbo Eventwhen it's be publishedvoidunregister(ServiceInstance serviceInstance)Unregisters an instance ofServiceInstance.-
从类继承的方法 org.apache.dubbo.registry.client.AbstractServiceDiscovery
getLocalInstance, register, update
-
从接口继承的方法 org.apache.dubbo.event.EventListener
getPriority
-
从接口继承的方法 org.apache.dubbo.common.lang.Prioritized
compareTo
-
从接口继承的方法 org.apache.dubbo.registry.client.ServiceDiscovery
dispatchServiceInstancesChangedEvent, dispatchServiceInstancesChangedEvent, dispatchServiceInstancesChangedEvent, dispatchServiceInstancesChangedEvent, getDefaultPageSize, getInstances, getInstances, getInstances, removeServiceInstancesChangedListener, toString
-
-
-
-
方法详细资料
-
onEvent
public void onEvent(ServiceInstancesChangedEvent event)
从接口复制的说明:EventListenerHandle aDubbo Eventwhen it's be published- 指定者:
onEvent在接口中EventListener<ServiceInstancesChangedEvent>- 参数:
event- aDubbo Event
-
initialize
public void initialize(URL registryURL) throws Exception
从接口复制的说明:ServiceDiscoveryInitializes theServiceDiscovery- 指定者:
initialize在接口中ServiceDiscovery- 参数:
registryURL- theurlto connect service registry- 抛出:
Exception- If met with error
-
getUrl
public URL getUrl()
- 指定者:
getUrl在接口中ServiceDiscovery
-
destroy
public void destroy()
从接口复制的说明:ServiceDiscoveryDestroy theServiceDiscovery- 指定者:
destroy在接口中ServiceDiscovery
-
doRegister
public void doRegister(ServiceInstance serviceInstance)
从类复制的说明:AbstractServiceDiscoveryIt should be implement in kinds of service discovers.- 指定者:
doRegister在类中AbstractServiceDiscovery
-
addServiceInstancesChangedListener
public void addServiceInstancesChangedListener(ServiceInstancesChangedListener listener) throws NullPointerException, IllegalArgumentException
从接口复制的说明:ServiceDiscoveryAdd an instance ofServiceInstancesChangedListenerfor specified serviceDefault, current method will be invoked by
the ServiceDiscoveryRegistry on the subscription, and it's mandatory toaddtheServiceInstancesChangedListenerargument intoEventDispatcherwhether the subclass implements same approach or not, thus this method is used to trigger or adapt the vendor's change notification mechanism typically, like Zookeeper Watcher, Nacos EventListener. If the registry observes the change, It's suggested that the implementation could invokeServiceDiscovery.dispatchServiceInstancesChangedEvent(String)method or variants- 指定者:
addServiceInstancesChangedListener在接口中ServiceDiscovery- 参数:
listener- an instance ofServiceInstancesChangedListener- 抛出:
NullPointerExceptionIllegalArgumentException- 另请参阅:
EventPublishingServiceDiscovery,EventDispatcher
-
doUpdate
public void doUpdate(ServiceInstance serviceInstance)
从类复制的说明:AbstractServiceDiscoveryIt should be implement in kinds of service discovers.- 指定者:
doUpdate在类中AbstractServiceDiscovery
-
unregister
public void unregister(ServiceInstance serviceInstance) throws RuntimeException
从接口复制的说明:ServiceDiscoveryUnregisters an instance ofServiceInstance.- 指定者:
unregister在接口中ServiceDiscovery- 参数:
serviceInstance- an instance ofServiceInstanceto be unregistered- 抛出:
RuntimeException- if failed
-
getServices
public Set<String> getServices()
从接口复制的说明:ServiceDiscoveryGets all service names- 指定者:
getServices在接口中ServiceDiscovery- 返回:
- non-null read-only
Set
-
getInstances
public List<ServiceInstance> getInstances(String serviceName) throws NullPointerException
从接口复制的说明:ServiceDiscoveryGets allservice instancesby the specified service name.- 指定者:
getInstances在接口中ServiceDiscovery- 参数:
serviceName- the service name- 返回:
- non-null
List - 抛出:
NullPointerException- ifserviceNameisnull
-
-