@Override
    public void joinedCluster() {
        // The local node joined a cluster.
        //
        // Upon joining a cluster, clustered caches are reset to their clustered equivalent (by the swap from the local
        // cache implementation to the clustered cache implementation that's done in the implementation of
        // org.jivesoftware.util.cache.CacheFactory.joinedCluster). This means that they now hold data that's
        // available on all other cluster nodes. Data that's available on the local node needs to be added again.
        restoreCacheContent();

        final DirectedPresenceListener listener = new DirectedPresenceListener();

        Log.debug("Simulate 'entryAdded' for all data that already exists elsewhere in the cluster.");
        directedPresencesCache.entrySet().stream()
            // this filter isn't needed if we do this before restoreCacheContent.
            .filter(entry -> !entry.getValue().isEmpty() && !Arrays.equals(entry.getValue().peek().getNodeID(), XMPPServer.getInstance().getNodeID().toByteArray()))
            .forEach(entry -> {
                assert entry.getValue().peek() != null; // should be impossible given the filter above.
                // We are assuming that the nodeID for every directed presence in the collection is equal.
                final NodeID nodeID = NodeID.getInstance(entry.getValue().peek().getNodeID());
                listener.entryAdded(entry.getKey(), entry.getValue(), nodeID);
            });

        // Add the entry listener to the cache. Note that, when #joinedCluster() fired, the cache will _always_ have been replaced,
        // meaning that it won't have old event listeners. When #leaveCluster() fires, the cache will be destroyed. This
        // takes away the need to explicitly deregister the listener in that case.
        final boolean includeValues = true; // This event handler needs to operate on cache values. We can't reduce overhead by suppressing value transmission.
        directedPresencesCache.addClusteredCacheEntryListener(listener, includeValues, false);
    }
Checks if the packet is a presence stanza that intends to reflect an update back to the client from which the update originated.

@param packet The stanza (cannot be null.
@return true if the packet is presence reflection, otherwise false.
xmppserver/src/main/java/org/jivesoftware/openfire/handler/PresenceUpdateHandler.java