public class DefaultSimpUserRegistry extends java.lang.Object implements SimpUserRegistry, SmartApplicationListener
SimpUserRegistry
that
listens ApplicationContext events of type AbstractSubProtocolEvent
to
keep track of user presence and subscription information.Modifier and Type | Class and Description |
---|---|
private static class |
DefaultSimpUserRegistry.DefaultSimpSession |
private static class |
DefaultSimpUserRegistry.DefaultSimpSubscription |
private static class |
DefaultSimpUserRegistry.DefaultSimpUser |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,DefaultSimpUserRegistry.DefaultSimpSession> |
sessions |
private java.util.Map<java.lang.String,DefaultSimpUserRegistry.DefaultSimpUser> |
users |
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()
Return the order value of this object, with a
higher value meaning greater in terms of sorting.
|
SimpUser |
getUser(java.lang.String userName)
Get the user for the given name.
|
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() |
private final java.util.Map<java.lang.String,DefaultSimpUserRegistry.DefaultSimpUser> users
private final java.util.Map<java.lang.String,DefaultSimpUserRegistry.DefaultSimpSession> sessions
public SimpUser getUser(java.lang.String userName)
SimpUserRegistry
getUser
in interface SimpUserRegistry
userName
- the name of the user to look upnull
if not connectedpublic java.util.Set<SimpUser> getUsers()
SimpUserRegistry
getUsers
in interface SimpUserRegistry
public java.util.Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
SimpUserRegistry
findSubscriptions
in interface SimpUserRegistry
matcher
- the matcher to usepublic boolean supportsEventType(java.lang.Class<? extends ApplicationEvent> eventType)
SmartApplicationListener
supportsEventType
in interface SmartApplicationListener
public boolean supportsSourceType(java.lang.Class<?> sourceType)
SmartApplicationListener
supportsSourceType
in interface SmartApplicationListener
public void onApplicationEvent(ApplicationEvent event)
ApplicationListener
onApplicationEvent
in interface ApplicationListener<ApplicationEvent>
event
- the event to respond topublic int getOrder()
Ordered
Normally starting with 0, with Integer.MAX_VALUE
indicating the greatest value. Same order values will result
in arbitrary positions for the affected objects.
Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).
public java.lang.String toString()
toString
in class java.lang.Object