Class ConsistencyChecks
- java.lang.Object
-
- org.jivesoftware.util.cache.ConsistencyChecks
-
public class ConsistencyChecks extends Object
This class defines methods that verify that the state of a cache and its various supporting data structures (in which some data duplication is expected) is consistent. This code has been taken from the classes that are responsible for maintaining the cache to reduce the code complexity of those classes.- Author:
- Guus der Kinderen, guus@goodbytes.nl
-
-
Constructor Summary
Constructors Constructor Description ConsistencyChecks()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.common.collect.Multimap<String,String>
generateReportForMucRooms(Cache<String,MUCRoom> clusteredRoomCacheInput, Map<String,MUCRoom> localRoomsInput, Map<NodeID,Set<OccupantManager.Occupant>> occupantsByNodeInput, Map<OccupantManager.Occupant,NodeID> nodeByOccupantInput, Set<OccupantManager.Occupant> federatedOccupantsInput, String mucServiceName)
static com.google.common.collect.Multimap<String,String>
generateReportForRoutingTableClientRoutes(Cache<String,ClientRoute> usersCache, Cache<String,ClientRoute> anonymousUsersCache, Collection<LocalClientSession> localClientRoutes, Map<NodeID,Set<String>> routeOwnersByClusterNode)
Verifies that usersCache, anonymousUsersCache, localRoutingTable.getClientRoutes and routeOwnersByClusterNode ofRoutingTableImpl
are in a consistent state.static com.google.common.collect.Multimap<String,String>
generateReportForRoutingTableComponentRoutes(Cache<String,HashSet<NodeID>> componentsCache, Collection<RoutableChannelHandler> localComponentRoutes, HashMap<NodeID,Set<String>> componentsByClusterNode)
Verifies that #componentsCache, #localRoutingTable#getComponentRoute and #componentsByClusterNode ofRoutingTableImpl
are in a consistent state.static com.google.common.collect.Multimap<String,String>
generateReportForRoutingTableServerRoutes(Cache<DomainPair,NodeID> serversCache, Collection<LocalOutgoingServerSession> localServerRoutes, HashMap<NodeID,Set<DomainPair>> s2sDomainPairsByClusterNode)
Verifies that #serversCache, #localRoutingTable#getServerRoutes and #s2sDomainPairsByClusterNode ofRoutingTableImpl
are in a consistent state.static com.google.common.collect.Multimap<String,String>
generateReportForSessionManagerIncomingServerSessions(Cache<StreamID,IncomingServerSessionInfo> incomingServerSessionsCache, Collection<LocalIncomingServerSession> localIncomingServerSessions, Map<NodeID,Set<StreamID>> incomingServerSessionsByClusterNode)
Verifies that #incomingServerSessionsCache, #localIncomingServerSessions and #incomingServerSessionsByClusterNode ofSessionManager
are in a consistent state.static com.google.common.collect.Multimap<String,String>
generateReportForSessionManagerSessionInfos(Cache<String,ClientSessionInfo> sessionInfoCache, Collection<ClientSession> localSessions, Map<NodeID,Set<String>> sessionInfoKeysByClusterNode)
Verifies that #sessionInfoCache, #localSessionInfos and #sessionInfoKeysByClusterNode ofSessionManager
are in a consistent state.static com.google.common.collect.Multimap<String,String>
generateReportForUserSessions(Cache<String,HashSet<String>> usersSessionsCache, Cache<String,ClientRoute> usersCache, Cache<String,ClientRoute> anonymousUsersCache)
-
-
-
Method Detail
-
generateReportForRoutingTableServerRoutes
public static com.google.common.collect.Multimap<String,String> generateReportForRoutingTableServerRoutes(@Nonnull Cache<DomainPair,NodeID> serversCache, @Nonnull Collection<LocalOutgoingServerSession> localServerRoutes, @Nonnull HashMap<NodeID,Set<DomainPair>> s2sDomainPairsByClusterNode)
Verifies that #serversCache, #localRoutingTable#getServerRoutes and #s2sDomainPairsByClusterNode ofRoutingTableImpl
are 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.
- Parameters:
serversCache
- The cache that is used to share data across cluster nodeslocalServerRoutes
- The data structure that keeps track of what data was added to the cache by the local cluster node.s2sDomainPairsByClusterNode
- The data structure that keeps track of what data was added to the cache by the remote cluster nodes.- Returns:
- A consistency state report.
-
generateReportForRoutingTableComponentRoutes
public static com.google.common.collect.Multimap<String,String> generateReportForRoutingTableComponentRoutes(@Nonnull Cache<String,HashSet<NodeID>> componentsCache, @Nonnull Collection<RoutableChannelHandler> localComponentRoutes, @Nonnull HashMap<NodeID,Set<String>> componentsByClusterNode)
Verifies that #componentsCache, #localRoutingTable#getComponentRoute and #componentsByClusterNode ofRoutingTableImpl
are 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.
- Parameters:
componentsCache
- The cache that is used to share data across cluster nodeslocalComponentRoutes
- The data structure that keeps track of what data was added to the cache by the local cluster node.componentsByClusterNode
- The data structure that keeps track of what data was added to the cache by the remote cluster nodes.- Returns:
- A consistency state report.
-
generateReportForRoutingTableClientRoutes
public static com.google.common.collect.Multimap<String,String> generateReportForRoutingTableClientRoutes(@Nonnull Cache<String,ClientRoute> usersCache, @Nonnull Cache<String,ClientRoute> anonymousUsersCache, @Nonnull Collection<LocalClientSession> localClientRoutes, @Nonnull Map<NodeID,Set<String>> routeOwnersByClusterNode)
Verifies that usersCache, anonymousUsersCache, localRoutingTable.getClientRoutes and routeOwnersByClusterNode ofRoutingTableImpl
are 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.
- Parameters:
usersCache
- The cache that is used to share data across cluster nodesanonymousUsersCache
- The cache that is used to share data across cluster nodeslocalClientRoutes
- The data structure that keeps track of what data was added to the cache by the local cluster node.routeOwnersByClusterNode
- The data structure that keeps track of what data was added to the cache by the remote cluster nodes.- Returns:
- A consistency state report.
-
generateReportForSessionManagerIncomingServerSessions
public static com.google.common.collect.Multimap<String,String> generateReportForSessionManagerIncomingServerSessions(@Nonnull Cache<StreamID,IncomingServerSessionInfo> incomingServerSessionsCache, @Nonnull Collection<LocalIncomingServerSession> localIncomingServerSessions, @Nonnull Map<NodeID,Set<StreamID>> incomingServerSessionsByClusterNode)
Verifies that #incomingServerSessionsCache, #localIncomingServerSessions and #incomingServerSessionsByClusterNode ofSessionManager
are 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.
- Parameters:
incomingServerSessionsCache
- The cache that is used to share data across cluster nodeslocalIncomingServerSessions
- The data structure that keeps track of what data was added to the cache by the local cluster node.incomingServerSessionsByClusterNode
- The data structure that keeps track of what data was added to the cache by the remote cluster nodes.- Returns:
- A consistency state report.
-
generateReportForSessionManagerSessionInfos
public static com.google.common.collect.Multimap<String,String> generateReportForSessionManagerSessionInfos(@Nonnull Cache<String,ClientSessionInfo> sessionInfoCache, @Nonnull Collection<ClientSession> localSessions, @Nonnull Map<NodeID,Set<String>> sessionInfoKeysByClusterNode)
Verifies that #sessionInfoCache, #localSessionInfos and #sessionInfoKeysByClusterNode ofSessionManager
are 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.
- Parameters:
sessionInfoCache
- The cache that is used to share data across cluster nodes. (note that unlike its siblings, this is empty when not clustering!)localSessions
- The data structure that keeps track of what data was added to the cache by the local cluster node.sessionInfoKeysByClusterNode
- The data structure that keeps track of what data was added to the cache by the remote cluster nodes.- Returns:
- A consistency state report.
-
generateReportForUserSessions
public static com.google.common.collect.Multimap<String,String> generateReportForUserSessions(@Nonnull Cache<String,HashSet<String>> usersSessionsCache, @Nonnull Cache<String,ClientRoute> usersCache, @Nonnull Cache<String,ClientRoute> anonymousUsersCache)
-
generateReportForMucRooms
public static com.google.common.collect.Multimap<String,String> generateReportForMucRooms(@Nonnull Cache<String,MUCRoom> clusteredRoomCacheInput, @Nonnull Map<String,MUCRoom> localRoomsInput, @Nonnull Map<NodeID,Set<OccupantManager.Occupant>> occupantsByNodeInput, @Nonnull Map<OccupantManager.Occupant,NodeID> nodeByOccupantInput, @Nonnull Set<OccupantManager.Occupant> federatedOccupantsInput, @Nonnull String mucServiceName)
-
-