public class MultiServerUserRegistry extends Object implements SimpUserRegistry, org.springframework.context.event.SmartApplicationListener
SimpUserRegistry that looks up users in a "local" user registry as
well as a set of "remote" user registries. The local registry is provided as
a constructor argument while remote registries are updated via broadcasts
handled by UserRegistryMessageHandler which in turn notifies this
registry when updates are received.| Constructor and Description |
|---|
MultiServerUserRegistry(SimpUserRegistry localRegistry)
Create an instance wrapping the local user registry.
|
| Modifier and Type | Method and Description |
|---|---|
Set<SimpSubscription> |
findSubscriptions(SimpSubscriptionMatcher matcher)
Find subscriptions with the given matcher.
|
int |
getOrder() |
SimpUser |
getUser(String userName)
Get the user for the given name.
|
int |
getUserCount()
Return the count of all connected users.
|
Set<SimpUser> |
getUsers()
Return a snapshot of all connected users.
|
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
boolean |
supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType) |
boolean |
supportsSourceType(Class<?> sourceType) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MultiServerUserRegistry(SimpUserRegistry localRegistry)
public int getOrder()
getOrder in interface org.springframework.context.event.SmartApplicationListenergetOrder in interface org.springframework.core.Orderedpublic boolean supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType)
supportsEventType in interface org.springframework.context.event.SmartApplicationListenerpublic boolean supportsSourceType(@Nullable
Class<?> sourceType)
supportsSourceType in interface org.springframework.context.event.SmartApplicationListenerpublic void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>@Nullable public SimpUser getUser(String userName)
SimpUserRegistrygetUser in interface SimpUserRegistryuserName - the name of the user to look upnull if not connectedpublic Set<SimpUser> getUsers()
SimpUserRegistryThe returned set is a copy and will not reflect further changes.
getUsers in interface SimpUserRegistrypublic int getUserCount()
SimpUserRegistrygetUserCount in interface SimpUserRegistrypublic Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
SimpUserRegistryfindSubscriptions in interface SimpUserRegistrymatcher - the matcher to use