@Override
    public void userDeleting(User user, Map<String, Object> params) {
        // Delete this user's association in entityCapabilitiesUserMap.
        final JID bareJid = XMPPServer.getInstance().createJID(user.getUsername(), null, true);

        final Set<String> deletedUserVerHashes = new HashSet<>();

        // Remember: Caches are not regular maps. The EntrySet is immutable.
        // We'll first find the keys, then remove them in a separate call.
        final Lock lock = entityCapabilitiesUserMap.getLock(bareJid);
        lock.lock();
        try {
            // Iterating over the entire set is not ideal from a performance perspective. Note that this is a
            // local cache. Things would have been much worse if this had been a clustered cache.
            final Set<JID> jidsToRemove = entityCapabilitiesUserMap.keySet().stream()
                .filter(jid -> jid.asBareJID().equals(bareJid))
                .collect(Collectors.toSet());

            for (final JID jidToRemove : jidsToRemove) {
                final String removed = entityCapabilitiesUserMap.remove(jidToRemove);
                if (removed != null) {
                    deletedUserVerHashes.add(removed);
                }
            }
        } finally {
            lock.unlock();
        }

        // If there are no other references to the deleted user's 'ver' hash,
        // it is safe to remove that 'ver' hash's associated entity
        // capabilities from the entityCapabilitiesMap cache.
        deletedUserVerHashes.forEach( this::checkObsolete );
    }
Invokes the entityCapabilitiesChanged method of all currently registered event listeners.

It is assumed that this method is used to notify listeners of a change in capabilities for a particular entity.

@param entity The entity for which an event is to be dispatched
@param updatedEntityCapabilities The most up-to-date capabilities.
@param previousEntityCapabilities The capabilities, if any, prior to the update.
xmppserver/src/main/java/org/jivesoftware/openfire/entitycaps/EntityCapabilitiesManager.java