use of org.apache.dubbo.registry.support.AbstractRegistry in project dubbo by alibaba.
the class ServiceCheckUtils method getConsumerAddressNum.
public static int getConsumerAddressNum(ConsumerModel consumerModel) {
// TODO, only check one registry by default.
int num = 0;
Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
if (CollectionUtils.isNotEmpty(registries)) {
AbstractRegistry abstractRegistry = (AbstractRegistry) registries.iterator().next();
for (Map.Entry<URL, Map<String, List<URL>>> entry : abstractRegistry.getNotified().entrySet()) {
if (entry.getKey().getServiceKey().equals(consumerModel.getServiceKey())) {
if (CollectionUtils.isNotEmptyMap(entry.getValue())) {
num = entry.getValue().size();
}
}
}
}
return num;
}
use of org.apache.dubbo.registry.support.AbstractRegistry in project incubator-dubbo-ops by apache.
the class ServiceControllerTest method tearDown.
@After
public void tearDown() throws Exception {
final Set<URL> registered = ((AbstractRegistry) registry).getRegistered();
for (final URL url : registered) {
try {
registry.unregister(url);
} catch (Exception ignored) {
}
}
TimeUnit.SECONDS.sleep(1);
}
Aggregations