@Nullable
    public Set<Occupant> leftCluster()
    {
        // Note: it is assumed that users on federated domains have _not_ lost connectivity. Federation can be
        // re-established from the local server, if it previously was established at the node that has now left.

        final NodeID ownNodeID = XMPPServer.getInstance().getNodeID();
        mutex.writeLock().lock();
        try {
            final Map<JID, Set<Occupant>> occupantsLeftOnThisNode = localOccupantsByNode.getOrDefault(ownNodeID, new HashMap<>());

            final Set<Occupant> occupantsRemoved = new HashSet<>();
            for (Map.Entry<NodeID, Map<JID, Set<Occupant>>> entry : localOccupantsByNode.entrySet()) {
                if (entry.getKey().equals(ownNodeID)) {
                    continue;
                }
                for (final Map.Entry<JID, Set<Occupant>> occupantsOnRemoteNode : entry.getValue().entrySet()) {
                    final Set<Occupant> localOccupantsForJID = occupantsLeftOnThisNode.get(occupantsOnRemoteNode.getKey());
                    if (localOccupantsForJID == null) {
                        occupantsRemoved.addAll(occupantsOnRemoteNode.getValue());
                    } else {
                        for (final Occupant occupantOnRemoteNode : occupantsOnRemoteNode.getValue()) {
                            if (!localOccupantsForJID.contains(occupantOnRemoteNode)) {
                                occupantsRemoved.add(occupantOnRemoteNode);
                            }
                        }
                    }
                }
            }

            // Now actually remove what needs to be removed
            localOccupantsByNode.entrySet().removeIf(e -> !e.getKey().equals(ownNodeID));

            nodeByLocalOccupant.clear();
            occupantsLeftOnThisNode.values().stream().flatMap(Collection::stream)
                .forEach(o -> nodeByLocalOccupant.put(o, ownNodeID));

            Log.debug("Reset occupants because we left the cluster");
            return occupantsRemoved;
        } finally {
            mutex.writeLock().unlock();
        }
    }
Removes and returns all data that was maintained for cluster nodes other than the local node. It is assumed that
this method is used in reaction to the local cluster node having left the cluster.

@return All data that this instance maintained for all cluster nodes except the local one.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/OccupantManager.java