public class DefaultSimpUserRegistry extends java.lang.Object implements SimpUserRegistry, SmartApplicationListener
SimpUserRegistry that relies on
AbstractSubProtocolEvent application context events to keep track of
connected users and their subscriptions.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
DefaultSimpUserRegistry() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<SimpSubscription> |
findSubscriptions(SimpSubscriptionMatcher matcher)
Find subscriptions with the given matcher.
|
int |
getOrder()
Get the order value of this object.
|
SimpUser |
getUser(java.lang.String userName)
Get the user for the given name.
|
int |
getUserCount()
Return the count of all connected users.
|
java.util.Set<SimpUser> |
getUsers()
Return a snapshot of all connected users.
|
void |
onApplicationEvent(ApplicationEvent event)
Handle an application event.
|
boolean |
supportsEventType(java.lang.Class<? extends ApplicationEvent> eventType)
Determine whether this listener actually supports the given event type.
|
boolean |
supportsSourceType(java.lang.Class<?> sourceType)
Determine whether this listener actually supports the given source type.
|
java.lang.String |
toString() |
public int getOrder()
OrderedHigher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet load-on-startup values).
Same order values will result in arbitrary sort positions for the affected objects.
getOrder in interface OrderedOrdered.HIGHEST_PRECEDENCE,
Ordered.LOWEST_PRECEDENCEpublic boolean supportsEventType(java.lang.Class<? extends ApplicationEvent> eventType)
SmartApplicationListenersupportsEventType in interface SmartApplicationListenereventType - the event type (never null)public void onApplicationEvent(ApplicationEvent event)
ApplicationListeneronApplicationEvent in interface ApplicationListener<ApplicationEvent>event - the event to respond topublic boolean supportsSourceType(java.lang.Class<?> sourceType)
SmartApplicationListenersupportsSourceType in interface SmartApplicationListenersourceType - the source type, or null if no sourcepublic SimpUser getUser(java.lang.String userName)
SimpUserRegistrygetUser in interface SimpUserRegistryuserName - the name of the user to look upnull if not connectedpublic java.util.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 java.util.Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
SimpUserRegistryfindSubscriptions in interface SimpUserRegistrymatcher - the matcher to usepublic java.lang.String toString()
toString in class java.lang.Object