@Override
    public void leftCluster() {
        // The local cluster node left the cluster.
        if (XMPPServer.getInstance().isShuttingDown()) {
            // Do not put effort in restoring the correct state if we're shutting down anyway.
            return;
        }

        // Upon leaving a cluster, clustered caches are reset to their local equivalent (by the swap from the clustered
        // cache implementation to the default cache implementation that's done in the implementation of
        // org.jivesoftware.util.cache.CacheFactory.leftCluster). This means that they now hold no data (as a new cache
        // has been created). Data that's available on the local node needs to be added again.
        restoreCacheContent();

        // All clients on all other nodes are now unavailable! Simulate an unavailable presence for sessions that were
        // being hosted in other cluster nodes.
        Set<JID> removedRoutes = new HashSet<>();
        routeOwnersByClusterNode.values().stream().flatMap(Collection::stream).forEach( fullJID -> {
            final JID offlineJID = new JID(fullJID);
            removeClientRoute(offlineJID);
            removedRoutes.add(offlineJID);
        });
        routeOwnersByClusterNode.clear();

        // Remove outgoing server sessions hosted in node that left the cluster
        for (Map.Entry<NodeID, Set<DomainPair>> entry : s2sDomainPairsByClusterNode.entrySet()) {
            final NodeID nodeID = entry.getKey();
            final Set<DomainPair> domainPairs = entry.getValue();
            domainPairs.forEach(domainPair -> {
                try {
                    if (!removeServerRoute(domainPair, nodeID)) {
                        Log.warn("We have left the cluster. Federated connections on other nodes are no longer available. To reflect this, we're deleting these routes. While doing this for '{}' on node '{}', the session could not be removed (presumably because it is not available on that cluster node).", domainPair, nodeID);
                    }
                } catch (Exception e) {
                    Log.error("We have left the cluster. Federated connections on other nodes are no longer available. To reflect this, we're deleting these routes. While doing this for '{}' on node '{}', this caused an exception to occur.", domainPair, nodeID, e);
                }
            });
        }
        s2sDomainPairsByClusterNode.clear();

        // Remove component connections hosted in node that left the cluster
        for (Map.Entry<NodeID, Set<String>> entry : componentsByClusterNode.entrySet()) {
            NodeID nodeId = entry.getKey();
            for (String componentJid : entry.getValue()) {
                removeComponentRoute(new JID(componentJid), nodeId);
            }
        }

        restoreUsersSessionsCache();

        removedRoutes.forEach(offlineJID -> {
            try {
                final Presence presence = new Presence(Presence.Type.unavailable);
                presence.setFrom(offlineJID);
                XMPPServer.getInstance().getPresenceRouter().route(presence);
            }
            catch (final PacketException e) {
                Log.error("We have left the cluster. Users on other cluster nodes are no longer available. To reflect this, we're broadcasting presence unavailable on their behalf. While doing this for '{}', this caused an exception to occur.", offlineJID, e);
            }
        });
    }
Verifies that {@link #usersSessionsCache} and {@link #usersCache} 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.

@return A consistency state report.
@see #usersSessionsCache which tracks user sessions.
@see #usersCache which the cache that is used tho share data with other cluster nodes.
xmppserver/src/main/java/org/jivesoftware/openfire/spi/RoutingTableImpl.java