Top Description Inners Fields Constructors Methods
org.springframework.messaging.simp.user

public Class MultiServerUserRegistry

extends Object
implements SimpUserRegistry, SmartApplicationListener
Class Inheritance
All Implemented Interfaces
org.springframework.context.event.SmartApplicationListener, org.springframework.core.Ordered, org.springframework.context.ApplicationListener, java.util.EventListener, org.springframework.messaging.simp.user.SimpUserRegistry
Annotations
@SuppressWarnings:serial
Imports
java.net.InetAddress, .UnknownHostException, java.security.Principal, java.util.Collections, .HashMap, .HashSet, .Map, .Objects, .Set, .UUID, java.util.concurrent.ConcurrentHashMap, org.springframework.context.ApplicationEvent, org.springframework.context.event.SmartApplicationListener, org.springframework.core.Ordered, org.springframework.lang.Nullable, org.springframework.messaging.Message, org.springframework.messaging.converter.MessageConverter, org.springframework.util.Assert, .CollectionUtils, .ObjectUtils

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.
Author
Rossen Stoyanchev
Since
4.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
MultiServerUserRegistry.SessionLookup

Helper class to find user sessions across all servers.

private static class
MultiServerUserRegistry.TransferSimpSession

SimpSession that can be (de)serialized and broadcast to other servers.

private static class
MultiServerUserRegistry.TransferSimpSubscription

SimpSubscription that can be (de)serialized and broadcast to other servers.

private static class
MultiServerUserRegistry.TransferSimpUser

SimpUser that can be (de)serialized and broadcast to other servers.

private static class
MultiServerUserRegistry.UserRegistrySnapshot

Holds a copy of a SimpUserRegistry for the purpose of broadcasting to and receiving broadcasts from other application servers.

Field Summary

Modifier and TypeField and Description
private final boolean
private final String
private final SimpUserRegistry
private final Map<String, MultiServerUserRegistry.UserRegistrySnapshot>
private final MultiServerUserRegistry.SessionLookup

Constructor Summary

AccessConstructor and Description
public
MultiServerUserRegistry(SimpUserRegistry localRegistry)

Create an instance wrapping the local user registry.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addRemoteRegistryDto(Message<?> message, MessageConverter converter, long expirationPeriod)

public Set<SimpSubscription>
findSubscriptions(SimpSubscriptionMatcher
the matcher to use
matcher
)

Implements org.springframework.messaging.simp.user.SimpUserRegistry.findSubscriptions.

Find subscriptions with the given matcher.

private static String
pack-priv Object
public int
getOrder()

Overrides default org.springframework.context.event.SmartApplicationListener.getOrder.

Determine this listener's order in a set of listeners for the same event.

public SimpUser
getUser(String
the name of the user to look up
userName
)

Implements org.springframework.messaging.simp.user.SimpUserRegistry.getUser.

Get the user for the given name.

public int
getUserCount()

Implements org.springframework.messaging.simp.user.SimpUserRegistry.getUserCount.

Return the count of all connected users.

public Set<SimpUser>
getUsers()

Implements org.springframework.messaging.simp.user.SimpUserRegistry.getUsers.

Return a snapshot of all connected users.

public void
onApplicationEvent(ApplicationEvent
the event to respond to
event
)

Implements org.springframework.context.ApplicationListener.onApplicationEvent.

Handle an application event.

pack-priv void
public boolean
supportsEventType(Class<? extends ApplicationEvent>
the event type (never null)
eventType
)

Implements org.springframework.context.event.SmartApplicationListener.supportsEventType.

Determine whether this listener actually supports the given event type.

public boolean
supportsSourceType(Class<?>
the source type, or null if no source
sourceType
)

Overrides default org.springframework.context.event.SmartApplicationListener.supportsSourceType.

Determine whether this listener actually supports the given source type.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait