use of com.alipay.sofa.registry.client.api.registration.SubscriberRegistration in project dubbo by apache.
the class SofaRegistryServiceDiscovery method registerServiceWatcher.
protected void registerServiceWatcher(String serviceName, ServiceInstancesChangedListener listener) {
Subscriber subscriber = subscribers.get(serviceName);
if (null == subscriber) {
final CountDownLatch latch = new CountDownLatch(1);
SubscriberRegistration subscriberRegistration = new SubscriberRegistration(serviceName, (dataId, data) -> {
handleRegistryData(dataId, data, listener, latch);
});
subscriberRegistration.setGroup(DEFAULT_GROUP);
subscriberRegistration.setScopeEnum(ScopeEnum.global);
subscriber = registryClient.register(subscriberRegistration);
subscribers.put(serviceName, subscriber);
waitAddress(serviceName, latch);
}
}
Aggregations