Implement allocation-friendly method to get user count in SimpUserRegistry
SPR-14930
This commit is contained in:
@@ -135,6 +135,16 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserCount() {
|
||||
int userCount = 0;
|
||||
for (UserRegistrySnapshot registry : this.remoteRegistries.values()) {
|
||||
userCount += registry.getUserMap().size();
|
||||
}
|
||||
userCount += this.localRegistry.getUserCount();
|
||||
return userCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher) {
|
||||
Set<SimpSubscription> result = new HashSet<>();
|
||||
|
||||
@@ -40,6 +40,13 @@ public interface SimpUserRegistry {
|
||||
*/
|
||||
Set<SimpUser> getUsers();
|
||||
|
||||
/**
|
||||
* Return the count of all connected users.
|
||||
* @return the connected user count.
|
||||
* @since 4.3.5
|
||||
*/
|
||||
int getUserCount();
|
||||
|
||||
/**
|
||||
* Find subscriptions with the given matcher.
|
||||
* @param matcher the matcher to use
|
||||
|
||||
Reference in New Issue
Block a user