Class SessionManager
- All Implemented Interfaces:
ClusterEventListener,Module
- Author:
- Derek DeMoro
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDetached(LocalSession localSession) Record a session as being detached (ie, has no connection).voidaddSession(LocalClientSession session) Add a new session to be managed.voidbroadcast(org.xmpp.packet.Message packet) Broadcasts the given data to all connected sessions.voidbroadcastPresenceToResources(org.xmpp.packet.JID originatingResource, org.xmpp.packet.Presence presence) Broadcasts presence updates from the originating user's resource to any of the user's existing available resources (including the resource from where the update originates).voidchangePriority(LocalClientSession session, int oldPriority) Change the priority of a session, that was already available, associated with the sender.Verifies thatincomingServerSessionInfoCache, {@link #localSessionManager#getIncomingServerSessions()} andincomingServerSessionInfoByClusterNodeare in a consistent state.Verifies thatsessionInfoCache, {@link #routingTable#getClientsRoutes(boolean)} andsessionInfoKeysByClusterNodeare in a consistent state.createClientHttpSession(StreamID id, HttpConnection connection, Locale language, Duration wait, int hold, boolean isEncrypted, Duration maxPollingInterval, int maxRequests, Duration maxPause, Duration defaultInactivityTimeout, int majorVersion, int minorVersion) Creates a newClientSessionwith the specified streamID.createClientSession(Connection conn, Locale language) Creates a newClientSession.createClientSession(Connection conn, StreamID id) Creates a newClientSessionwith the specified streamID.createClientSession(Connection conn, StreamID id, Locale language) Creates a newClientSessionwith the specified streamID.createComponentSession(org.xmpp.packet.JID address, Connection conn) createIncomingServerSession(Connection conn, StreamID id, String fromDomain) Creates a session for a remote server.createMultiplexerSession(Connection conn, org.xmpp.packet.JID address) Creates a newConnectionMultiplexerSession.intgetActiveSessionCount(String username) Returns the number of sessions for a user that are available.getComponentSession(String domain) Returns the session of the component whose domain matches the specified domain.Returns a collection with the established sessions from external components.intgetConnectionMultiplexerSession(org.xmpp.packet.JID address) Returns the session originated from the specified address ornullif none was found.Returns all sessions originated from connection managers.Returns a collection with all the sessions originated from the connection manager whose domain matches the specified domain.intgetConnectionsCount(boolean onlyLocal) Returns number of client sessions that are connected to the server.Returns remote domains for which the latest outgoing server-to-server connection establishment attempt failed.Returns a collection with the domain names of the remote servers that currently have an incoming server connection to this server.getIncomingServerSession(StreamID streamID) Returns the incoming server session hosted by this JVM that matches the specified stream ID.getIncomingServerSessions(String domain) Returns the list of sessions that were originated by a remote server.intgetIncomingServerSessionsCount(boolean onlyLocal) Returns number of sessions coming from remote servers.static SessionManagerReturns the instance ofSessionManagerImplbeing used by the XMPPServer.getLocaleForSession(org.xmpp.packet.JID address) Returns a collection with the domain names of the remote servers that currently may receive packets sent from this server.Returns a session that was originated from this server to a remote server.intintReturns the number of milliseconds to elapse between clearing of idle server sessions.getSession(org.xmpp.packet.JID from) Returns the session responsible for this JID data.intgetSessionCount(String username) intReturns a list that contains all authenticated client sessions connected to the server.getSessions(String username) Return all user sessions that match the definition of RoutingTable#getRoutes (notably, the sessions are 'available' / have sent initial presence).getSessions(SessionResultFilter filter) getSessions(org.xmpp.packet.JID from) Returns all sessions responsible for this JID.intgetUserSessionsCount(boolean onlyLocal) Returns number of client sessions that are authenticated with the server.voidinitialize(XMPPServer server) Initializes the basic module.booleanisActiveRoute(String username, String resource) booleanisAnonymousClientSession(String username) booleanisAnonymousClientSession(org.xmpp.packet.JID address) booleanisDetached(LocalSession localSession) Checks if a session is currently in the detached state (ie, has no connection, but has not been formally closed yet either).booleanReturns true if remote servers are allowed to have more than one connection to this server.static booleanReturns true if the session should broadcast presences to all other resources for the current client.booleanisPreAuthenticatedSession(org.xmpp.packet.JID address) Returns true if the specified address belongs to a preauthenticated session.voidNotification event indicating that this JVM is now part of a cluster.voidjoinedCluster(byte[] nodeID) Notification event indicating that another JVM is now part of a cluster.voidNotification event indicating that this JVM is no longer part of the cluster.voidleftCluster(byte[] nodeID) Notification event indicating that another JVM is no longer part of the cluster.voidNotification event indicating that this JVM is now the senior cluster member.Returns a randomly created ID to be used in a stream element.voidNotification message that a new OutgoingServerSession has been created.voidregisterIncomingServerSession(String domain, LocalIncomingServerSession session) Registers that a server session originated by a remote server is hosting a given domain.voidbooleanremoveDetached(LocalSession localSession) Remove a session as being detached.booleanremoveSession(ClientSession session, org.xmpp.packet.JID fullJID, boolean anonymous, boolean forceUnavailable) Removes a session.booleanremoveSession(LocalClientSession session) Removes a session.voidsendServerMessage(String subject, String body) Sends a message with a given subject and body to all the active user sessions in the server.voidsendServerMessage(org.xmpp.packet.JID address, String subject, String body) Sends a message with a given subject and body to one or more user sessions related to the specified address.voidsessionAvailable(LocalClientSession session, org.xmpp.packet.Presence presence) Notification message sent when a client sent an available presence for the session.voidsessionUnavailable(LocalClientSession session) Notification message sent when a client sent an unavailable presence for the session.voidsetConflictKickLimit(int limit) voidsetMultipleServerConnectionsAllowed(boolean allowed) Sets if remote servers are allowed to have more than one connection to this server.voidsetServerSessionIdleTime(int idleTime) voidsetServerSessionTimeout(int timeout) Sets the number of milliseconds to elapse between clearing of idle server sessions.voidsetSessionDetachTime(int idleTime) voidstart()Starts the basic module.voidstop()Stops the basic module.voidterminateDetached(LocalSession session) Terminate a session that is detached.voidunregisterIncomingServerSession(String domain, LocalIncomingServerSession session) Unregisters the specified remote domain that previously originated from the specified session of a remote server.voidunregisterIncomingServerSession(StreamID streamID) Unregisters a remote server session identified by a stream ID, and disassociates all associated domains.voiduserBroadcast(String username, org.xmpp.packet.Packet packet) Broadcasts the given data to all connected sessions for a particular user.Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName
-
Field Details
-
COMPONENT_SESSION_CACHE_NAME
- See Also:
-
CM_CACHE_NAME
- See Also:
-
ISS_CACHE_NAME
- See Also:
-
DOMAIN_SESSIONS_CACHE_NAME
- See Also:
-
C2S_INFO_CACHE_NAME
- See Also:
-
NEVER_KICK
public static final int NEVER_KICK- See Also:
-
-
Constructor Details
-
SessionManager
public SessionManager()
-
-
Method Details
-
getInstance
Returns the instance ofSessionManagerImplbeing used by the XMPPServer.- Returns:
- the instance of
SessionManagerImplbeing used by the XMPPServer.
-
addDetached
Record a session as being detached (ie, has no connection). This is idempotent. This should really only be called by the LocalSession itself when it detaches.- Parameters:
localSession- the LocalSession (this) to mark as detached.
-
isDetached
Checks if a session is currently in the detached state (ie, has no connection, but has not been formally closed yet either).- Parameters:
localSession- A session- Returns:
- true if the session is currently in 'detached' state, otherwise 'false'.
-
terminateDetached
Terminate a session that is detached. A presence 'unavailable' is broadcast for the session that's being terminated. The session will be removed from the routing table. When the provided session is not recognized as a detached session (on this cluster node), then this method will log a message but not apply any changes.- Parameters:
session- The (detached) session to be terminated.
-
removeDetached
Remove a session as being detached. This is idempotent. This should be called by the LocalSession itself either when resumed or when closed.- Parameters:
localSession- the LocalSession (this) which has been resumed or closed.
-
getConnectionMultiplexerSession
Returns the session originated from the specified address ornullif none was found. The specified address MUST contain a resource that uniquely identifies the session. A single connection manager should connect to the same node.- Parameters:
address- the address of the connection manager (including resource that identifies specific socket)- Returns:
- the session originated from the specified address.
-
getConnectionMultiplexerSessions
Returns all sessions originated from connection managers.- Returns:
- all sessions originated from connection managers.
-
getConnectionMultiplexerSessions
Returns a collection with all the sessions originated from the connection manager whose domain matches the specified domain. If there is no connection manager with the specified domain then an empty list is going to be returned.- Parameters:
domain- the domain of the connection manager.- Returns:
- a collection with all the sessions originated from the connection manager whose domain matches the specified domain.
-
createMultiplexerSession
public LocalConnectionMultiplexerSession createMultiplexerSession(Connection conn, org.xmpp.packet.JID address) Creates a newConnectionMultiplexerSession.- Parameters:
conn- the connection to create the session from.address- the JID (may include a resource) of the connection manager's session.- Returns:
- a newly created session.
-
nextStreamID
Returns a randomly created ID to be used in a stream element.- Returns:
- a randomly created ID to be used in a stream element.
-
createClientSession
Creates a newClientSession. The new Client session will have a newly created stream ID.- Parameters:
conn- the connection to create the session from.language- The language to use for the new session.- Returns:
- a newly created session.
-
createClientSession
Creates a newClientSessionwith the specified streamID.- Parameters:
conn- the connection to create the session from.id- the streamID to use for the new session.- Returns:
- a newly created session.
-
createClientSession
Creates a newClientSessionwith the specified streamID.- Parameters:
conn- the connection to create the session from.id- the streamID to use for the new session.language- The language to use for the new session.- Returns:
- a newly created session.
-
createClientHttpSession
public HttpSession createClientHttpSession(StreamID id, HttpConnection connection, Locale language, Duration wait, int hold, boolean isEncrypted, Duration maxPollingInterval, int maxRequests, Duration maxPause, Duration defaultInactivityTimeout, int majorVersion, int minorVersion) throws UnauthorizedException, UnknownHostException Creates a newClientSessionwith the specified streamID.- Parameters:
connection- the connection to create the session from.id- the streamID to use for the new session.language- The language to use for the sessionwait- The longest time it is permissible to wait for a response.hold- The maximum number of simultaneous waiting requests.isEncrypted- True if all connections on this session should be encrypted, and false if they should not.maxPollingInterval- The max interval within which a client can send polling requests.maxRequests- The max number of requests it is permissible for the session to have open at any one time.maxPause- The maximum length of a temporary session pause (in seconds) that the client MAY request.defaultInactivityTimeout- The default inactivity timeout of this session.majorVersion- the major version of BOSH specification which this session utilizes.minorVersion- the minor version of BOSH specification which this session utilizes.- Returns:
- a newly created session.
- Throws:
UnauthorizedException- if the server has not been initialisedUnknownHostException- if no IP address for the peer could be found,
-
createComponentSession
-
removeComponentSession
-
createIncomingServerSession
public LocalIncomingServerSession createIncomingServerSession(Connection conn, StreamID id, String fromDomain) throws UnauthorizedException Creates a session for a remote server. The session should be created only after the remote server has been authenticated either using "server dialback" or SASL.- Parameters:
conn- the connection to the remote server.id- the stream ID used in the stream element when authenticating the server.fromDomain- The originating domain- Returns:
- the newly created
IncomingServerSession. - Throws:
UnauthorizedException- if the local server has not been initialized yet.
-
outgoingServerSessionCreated
Notification message that a new OutgoingServerSession has been created. Register a listener that will react when the connection gets closed.- Parameters:
session- the newly created OutgoingServerSession.
-
registerIncomingServerSession
Registers that a server session originated by a remote server is hosting a given domain. Notice that the remote server may be hosting several subdomains as well as virtual hosts so the same IncomingServerSession may be associated with many domains. If the remote server creates many sessions to this server (eg. one for each subdomain) then associate all the sessions with the originating server that created all the sessions.- Parameters:
domain- the domain that is being served by the remote server.session- the incoming server session to the remote server.
-
unregisterIncomingServerSession
public void unregisterIncomingServerSession(@Nonnull String domain, @Nonnull LocalIncomingServerSession session) Unregisters the specified remote domain that previously originated from the specified session of a remote server. This will retain a cache entry for the session as long as there is one or more validated domains remain associated with the session.- Parameters:
domain- the domain that is no longer being served by the remote server.session- the session from which to unregister the domain.
-
unregisterIncomingServerSession
Unregisters a remote server session identified by a stream ID, and disassociates all associated domains.- Parameters:
streamID- identifier for the session to unregister.
-
addSession
Add a new session to be managed. The session has been authenticated and resource binding has been done.- Parameters:
session- the session that was authenticated.
-
sessionAvailable
Notification message sent when a client sent an available presence for the session. Making the session available means that the session is now eligible for receiving messages from other clients. Sessions whose presence is not available may only receive packets (IQ packets) from the server. Therefore, an unavailable session remains invisible to other clients.- Parameters:
session- the session that receieved an available presence.presence- the presence for the session.
-
isOtherResourcePresenceEnabled
public static boolean isOtherResourcePresenceEnabled()Returns true if the session should broadcast presences to all other resources for the current client. When disabled it is not possible to broadcast presence packets to another resource of the connected user. This is desirable if you have a use case where you have many resources attached to the same user account.- Returns:
- true if presence should be broadcast to other resources of the same account
-
broadcastPresenceToResources
public void broadcastPresenceToResources(org.xmpp.packet.JID originatingResource, org.xmpp.packet.Presence presence) Broadcasts presence updates from the originating user's resource to any of the user's existing available resources (including the resource from where the update originates).- Parameters:
originatingResource- the full JID of the session that sent the presence update.presence- the presence.
-
changePriority
Change the priority of a session, that was already available, associated with the sender.- Parameters:
session- The session whose presence priority has been modifiedoldPriority- The old priority for the session
-
isAnonymousClientSession
-
isAnonymousClientSession
public boolean isAnonymousClientSession(@Nonnull org.xmpp.packet.JID address) -
isActiveRoute
-
getSession
Returns the session responsible for this JID data. The returned Session may have never sent an available presence (thus not have a route) or could be a Session that hasn't authenticated yet (i.e. preAuthenticatedSessions).- Parameters:
from- the sender of the packet.- Returns:
- the
Sessionassociated with the JID.
-
getSessions
Returns all sessions responsible for this JID. The returned Sessions may have never sent an available presence (thus not have a route) or could be a Session that hasn't authenticated yet (i.e. preAuthenticatedSessions). If the provided JID is a full JID, this method behaves exactly likegetSession(JID), but returns the singular result (if any) in a collection of one element. If that method returned null, this method returns an empty collection.- Parameters:
from- the sender of the packet.- Returns:
- the
Sessionassociated with the JID. - See Also:
-
getSessions
Returns a list that contains all authenticated client sessions connected to the server. The list contains sessions of anonymous and non-anonymous users.- Returns:
- a list that contains all client sessions connected to the server.
-
getSessions
-
getIncomingServerSession
Returns the incoming server session hosted by this JVM that matches the specified stream ID.- Parameters:
streamID- the stream ID that identifies the incoming server session hosted by this JVM.- Returns:
- the incoming server session hosted by this JVM or null if none was found.
-
getIncomingServerSessions
Returns the list of sessions that were originated by a remote server. The list will be ordered chronologically. IncomingServerSession can only receive packets from the remote server but are not capable of sending packets to the remote server.- Parameters:
domain- the name of the remote server.- Returns:
- the sessions that were originated by a remote server.
-
getOutgoingServerSession
Returns a session that was originated from this server to a remote server. OutgoingServerSession an only send packets to the remote server but are not capable of receiving packets from the remote server.- Parameters:
pair- DomainPair describing the local and remote servers.- Returns:
- a session that was originated from this server to a remote server.
-
getOutgoingServerSessions
-
getSessions
Return all user sessions that match the definition of RoutingTable#getRoutes (notably, the sessions are 'available' / have sent initial presence).- Parameters:
username- The user for which to return sessions- Returns:
- sessions for the user
- See Also:
-
getConnectionsCount
public int getConnectionsCount(boolean onlyLocal) Returns number of client sessions that are connected to the server. Sessions that are authenticated and not authenticated will be included- Parameters:
onlyLocal- true if only sessions connected to this JVM will be considered. Otherwise count cluster wise.- Returns:
- number of client sessions that are connected to the server.
-
getUserSessionsCount
public int getUserSessionsCount(boolean onlyLocal) Returns number of client sessions that are authenticated with the server. This includes anonymous and non-anoymous users.- Parameters:
onlyLocal- true if only sessions connected to this JVM will be considered. Otherwise count cluster wise.- Returns:
- number of client sessions that are authenticated with the server.
-
getIncomingServerSessionsCount
public int getIncomingServerSessionsCount(boolean onlyLocal) Returns number of sessions coming from remote servers. Current implementation is only counting sessions connected to this JVM and not adding up sessions connected to other cluster nodes.- Parameters:
onlyLocal- true if only sessions connected to this JVM will be considered. Otherwise count cluster wise.- Returns:
- number of sessions coming from remote servers.
-
getActiveSessionCount
Returns the number of sessions for a user that are available. For the count of all sessions for the user, including sessions that are just starting or closed.- Parameters:
username- the user.- Returns:
- number of available sessions for a user.
- See Also:
-
getSessionCount
-
getComponentSessions
Returns a collection with the established sessions from external components.- Returns:
- a collection with the established sessions from external components.
-
getComponentSession
Returns the session of the component whose domain matches the specified domain.- Parameters:
domain- the domain of the component session to look for.- Returns:
- the session of the component whose domain matches the specified domain.
-
getIncomingServers
Returns a collection with the domain names of the remote servers that currently have an incoming server connection to this server.- Returns:
- a collection with the domains of the remote servers that currently have an incoming server connection to this server.
-
getOutgoingServers
Returns a collection with the domain names of the remote servers that currently may receive packets sent from this server.- Returns:
- a collection with the domains of the remote servers that currently may receive packets sent from this server.
-
getFailedServers
Returns remote domains for which the latest outgoing server-to-server connection establishment attempt failed. Entries are cleared when a subsequent outgoing attempt to the same remote domain succeeds.- Returns:
- a collection of remote server domains.
-
getOutgoingDomainPairs
-
broadcast
public void broadcast(org.xmpp.packet.Message packet) Broadcasts the given data to all connected sessions. Excellent for server administration messages.- Parameters:
packet- the packet to be broadcast.
-
userBroadcast
Broadcasts the given data to all connected sessions for a particular user. Excellent for updating all connected resources for users such as roster pushes.- Parameters:
username- the user to send the boradcast to.packet- the packet to be broadcast.- Throws:
PacketException- if a packet exception occurs.
-
removeSession
Removes a session.- Parameters:
session- the session.- Returns:
- true if the requested session was successfully removed.
-
removeSession
public boolean removeSession(ClientSession session, org.xmpp.packet.JID fullJID, boolean anonymous, boolean forceUnavailable) Removes a session.- Parameters:
session- the session or null when session is derived from fullJID.fullJID- the address of the session.anonymous- true if the authenticated user is anonymous.forceUnavailable- true if an unavailable presence must be created and routed.- Returns:
- true if the requested session was successfully removed.
-
getConflictKickLimit
public int getConflictKickLimit() -
isPreAuthenticatedSession
public boolean isPreAuthenticatedSession(org.xmpp.packet.JID address) Returns true if the specified address belongs to a preauthenticated session. Preauthenticated sessions are only available to the local cluster node when running inside a cluster.- Parameters:
address- the address of the session.- Returns:
- true if the specified address belongs to a preauthenticated session.
-
setConflictKickLimit
public void setConflictKickLimit(int limit) -
getLocaleForSession
-
initialize
Description copied from class:BasicModuleInitializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
- Specified by:
initializein interfaceModule- Overrides:
initializein classBasicModule- Parameters:
server- the server hosting this module.
-
sendServerMessage
Sends a message with a given subject and body to all the active user sessions in the server.- Parameters:
subject- the subject to broadcast.body- the body to broadcast.
-
sendServerMessage
Sends a message with a given subject and body to one or more user sessions related to the specified address. If address is null or the address's node is null then the message will be sent to all the user sessions. But if the address includes a node but no resource then the message will be sent to all the user sessions of the requested user (defined by the node). Finally, if the address is a full JID then the message will be sent to the session associated to the full JID. If no session is found then the message is not sent.- Parameters:
address- the address that defines the sessions that will receive the message.subject- the subject to broadcast.body- the body to broadcast.
-
start
Description copied from class:BasicModuleStarts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
- Specified by:
startin interfaceModule- Overrides:
startin classBasicModule- Throws:
IllegalStateException- If start is called before initialize successfully returns
-
stop
public void stop()Description copied from class:BasicModuleStops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
- Specified by:
stopin interfaceModule- Overrides:
stopin classBasicModule
-
isMultipleServerConnectionsAllowed
public boolean isMultipleServerConnectionsAllowed()Returns true if remote servers are allowed to have more than one connection to this server. Having more than one connection may improve number of packets that can be transfered per second. This setting only used by the server dialback mehod.It is highly recommended that
getServerSessionTimeout()is enabled so that dead connections to this server can be easily discarded.- Returns:
- true if remote servers are allowed to have more than one connection to this server.
-
setMultipleServerConnectionsAllowed
public void setMultipleServerConnectionsAllowed(boolean allowed) Sets if remote servers are allowed to have more than one connection to this server. Having more than one connection may improve number of packets that can be transfered per second. This setting only used by the server dialback mehod.It is highly recommended that
getServerSessionTimeout()is enabled so that dead connections to this server can be easily discarded.- Parameters:
allowed- true if remote servers are allowed to have more than one connection to this server.
-
setServerSessionTimeout
public void setServerSessionTimeout(int timeout) Sets the number of milliseconds to elapse between clearing of idle server sessions.- Parameters:
timeout- the number of milliseconds to elapse between clearings.
-
getServerSessionTimeout
public int getServerSessionTimeout()Returns the number of milliseconds to elapse between clearing of idle server sessions.- Returns:
- the number of milliseconds to elapse between clearing of idle server sessions.
-
setServerSessionIdleTime
public void setServerSessionIdleTime(int idleTime) -
getServerSessionIdleTime
public int getServerSessionIdleTime() -
setSessionDetachTime
public void setSessionDetachTime(int idleTime) -
getSessionDetachTime
public int getSessionDetachTime() -
getSessionInfoCache
-
joinedCluster
public void joinedCluster()Description copied from interface:ClusterEventListenerNotification event indicating that this JVM is now part of a cluster. At this point theXMPPServer.getNodeID()holds the new nodeID value.When joining the cluster as the senior cluster member the
ClusterEventListener.markedAsSeniorClusterMember()event will be sent right after this event.At this point the CacheFactory holds clustered caches. That means that modifications to the caches will be reflected in the cluster. The clustered caches were just obtained from the cluster and no local cached data was automatically moved.
It is generally advisable that implementations of this method:- enrich clustered cache data, by (re)adding data from this JVM/cluster node to relevant caches
- invoke applicable event listeners, to reflect changes in availability of data on other cluster nodes.
- Specified by:
joinedClusterin interfaceClusterEventListener
-
joinedCluster
public void joinedCluster(byte[] nodeID) Description copied from interface:ClusterEventListenerNotification event indicating that another JVM is now part of a cluster.At this point the CacheFactory of the new node holds clustered caches. That means that modifications to the caches of this JVM will be reflected in the cluster and in particular in the new node.
- Specified by:
joinedClusterin interfaceClusterEventListener- Parameters:
nodeID- ID of the node that joined the cluster.
-
leftCluster
public void leftCluster()Description copied from interface:ClusterEventListenerNotification event indicating that this JVM is no longer part of the cluster. This could happen when disabling clustering support, removing the enterprise plugin that provides clustering support or connection to cluster got lost.Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were this JVM belonged was marked as "old" then all nodes of that island will get the
left cluster eventandjoined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where this JVM was the senior cluster member and when the islands met again then this JVM stopped being the senior member.At this point the CacheFactory holds local caches. That means that modifications to the caches will only affect this JVM. It is generally advisable that implementations of this method:
- restore relevant caches content, by repopulating the caches with data from this JVM/cluster node
- invoke applicable event listeners, to reflect changes in availability of data on other cluster nodes.
- Specified by:
leftClusterin interfaceClusterEventListener
-
leftCluster
public void leftCluster(byte[] nodeID) Description copied from interface:ClusterEventListenerNotification event indicating that another JVM is no longer part of the cluster. This could happen when disabling clustering support, removing the enterprise plugin that provides clustering support or connection to cluster got lost.Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were the other JVM belonged was marked as "old" then all nodes of that island will get the
left cluster eventandjoined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where the other JVM was the senior cluster member and when the islands met again then the other JVM stopped being the senior member.At this point the CacheFactory of the leaving node holds local caches. That means that modifications to the caches of this JVM will not affect the leaving node but other cluster members. It is generally advisable that implementations of this method invoke applicable event listeners, to reflect changes in availability of data (related to the node that left). Often, this action is orchestrated by only one of the remaining cluster nodes: the senior member.
- Specified by:
leftClusterin interfaceClusterEventListener- Parameters:
nodeID- ID of the node that is left the cluster.
-
markedAsSeniorClusterMember
public void markedAsSeniorClusterMember()Description copied from interface:ClusterEventListenerNotification event indicating that this JVM is now the senior cluster member. This could either happen when initially joining the cluster or when the senior cluster member node left the cluster and this JVM was marked as the new senior cluster member.Moreover, in the case of a "split brain" scenario (ie. separated cluster islands) each island will have its own senior cluster member. However, when the islands meet again there could only be one senior cluster member so one of the senior cluster members will stop playing that role. When that happens the JVM no longer playing that role will receive the
ClusterEventListener.leftCluster()andClusterEventListener.joinedCluster()events.- Specified by:
markedAsSeniorClusterMemberin interfaceClusterEventListener
-
clusteringStateConsistencyReportForIncomingServerSessionInfos
public com.google.common.collect.Multimap<String,String> clusteringStateConsistencyReportForIncomingServerSessionInfos()Verifies thatincomingServerSessionInfoCache, {@link #localSessionManager#getIncomingServerSessions()} andincomingServerSessionInfoByClusterNodeare in a consistent state. Note that this operation can be costly in terms of resource usage. Use with caution in large / busy systems. The returned multi-map can contain up to four keys: info, fail, pass, data. All entry values are a human readable description of a checked characteristic. When the state is consistent, no 'fail' entries will be returned.- Returns:
- A consistency state report.
- See Also:
-
which is the cache that is used tho share data with other cluster nodes.which holds content added to the caches by the local cluster node.which holds content added to the caches by cluster nodes other than the local node.
-
clusteringStateConsistencyReportForSessionInfos
public com.google.common.collect.Multimap<String,String> clusteringStateConsistencyReportForSessionInfos()Verifies thatsessionInfoCache, {@link #routingTable#getClientsRoutes(boolean)} andsessionInfoKeysByClusterNodeare in a consistent state. Note that this operation can be costly in terms of resource usage. Use with caution in large / busy systems. The returned multi-map can contain up to four keys: info, fail, pass, data. All entry values are a human readable description of a checked characteristic. When the state is consistent, no 'fail' entries will be returned.- Returns:
- A consistency state report.
- See Also:
-
which is the cache that is used tho share data with other cluster nodes.which holds content added to the caches by the local cluster node.which holds content added to the caches by cluster nodes other than the local node.
-