@Nonnull
    public Set<String> roomNamesForAddress(@Nonnull final JID realJID)
    {
        mutex.readLock().lock();
        try {
            if (XMPPServer.getInstance().isLocal(realJID)) {
                return nodeByLocalOccupant.keySet().stream()
                    .filter(occupant -> realJID.equals(occupant.getRealJID()))
                    .map(occupant -> occupant.roomName)
                    .collect(Collectors.toSet());
            } else {
                return federatedOccupants.getOrDefault(realJID, new HashSet<>()).stream()
                    .filter(occupant -> realJID.equals(occupant.getRealJID()))
                    .map(occupant -> occupant.roomName)
                    .collect(Collectors.toSet());
            }
        } finally {
            mutex.readLock().unlock();
        }
    }
Returns the name of all the rooms that a particular XMPP entity (user) is currently an occupant of.

@param realJID The XMPP address of a user
@return All room names that have the user as an occupant.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/OccupantManager.java