void restoreCacheContentAfterLeave(@Nullable final Set<OccupantManager.Occupant> occupantsOnRemovedNodes)
    {
        Log.debug( "Restoring cache content for cache '{}' after we left the cluster, by adding all MUC Rooms that are known to the local node.", ROOM_CACHE.getName() );

        final Map<String, List<OccupantManager.Occupant>> occupantsOnRemovedNodesByRoom;
        if (occupantsOnRemovedNodes == null) {
            occupantsOnRemovedNodesByRoom = Collections.emptyMap();
        } else {
            occupantsOnRemovedNodesByRoom = occupantsOnRemovedNodes.stream().collect(Collectors.groupingBy(OccupantManager.Occupant::getRoomName));
        }

        for (Map.Entry<String, MUCRoom> localRoomEntry : localRooms.entrySet()) {
            final String roomName = localRoomEntry.getKey();
            Log.trace("Re-adding local room '{}' to cluster cache.", roomName);
            final Lock lock = ROOM_CACHE.getLock(roomName);
            lock.lock();
            try {
                final MUCRoom room = localRoomEntry.getValue();

                // The state of the rooms in the clustered cache should be modified to remove all but our local occupants.
                final List<OccupantManager.Occupant> occupantsToRemove = occupantsOnRemovedNodesByRoom.get(roomName);
                if (occupantsToRemove != null) {
                    Log.trace("These occupants of the room are recognized as living on another cluster node. Removing them from the room: {}", occupantsToRemove.stream().map(OccupantManager.Occupant::getRealJID).map(JID::toString).collect(Collectors.joining( ", " )));
                    for (OccupantManager.Occupant occupantToRemove : occupantsToRemove) {
                        final MUCOccupant occupant = room.getOccupantByFullJID(occupantToRemove.getRealJID());
                        if (occupant == null) {
                            Log.trace("Trying to remove occupant '{}' but no role for that occupant exists in the room. Data inconsistency?", occupantToRemove.getRealJID());
                            continue;
                        }
                        room.removeOccupant(occupant);
                    }
                }

                // Place room in cluster cache.
                Log.trace("Re-added local room '{}' to cache, with occupants: {}", roomName, room.getOccupants().stream().map(MUCOccupant::getUserAddress).map(JID::toString).collect(Collectors.joining( ", " )));
                ROOM_CACHE.put(roomName, room);
            } finally {
                lock.unlock();
            }
        }
        recomputeNonPersistentRoomCount();
    }
When the local node is joining or leaving a cluster, {@link org.jivesoftware.util.cache.CacheFactory} will swap
the implementation used to instantiate caches. This causes the cache content to be 'reset': it will no longer
contain the data that's provided by the local node. This method restores data that's provided by the local node
in the cache. It is expected to be invoked right after leaving the cluster.

({@link org.jivesoftware.openfire.cluster.ClusterEventListener#leftCluster()} a cluster.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoomManager.java