Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a new method for getting the number of consumer service addresses… #8026

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,24 @@ public static int getConsumerAddressNum(ConsumerModel consumerModel) {
}
return num;
}

//for the situation that QoS wants to query the address number of a consumer in all Registries
public static int getConsumerAddressNumInAllRegistries(ConsumerModel consumerModel){
chickenlj marked this conversation as resolved.
Show resolved Hide resolved
int num = 0;

Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
if(CollectionUtils.isNotEmpty(registries)){
for(Registry registry: registries){
AbstractRegistry abstractRegistry = (AbstractRegistry) registry;
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;
}
}