public int numberOfUniqueUsers()
    {
        mutex.readLock().lock();
        try {
            return nodeByLocalOccupant.size() + federatedOccupants.values().stream().mapToInt(Collection::size).sum();
        } finally {
            mutex.readLock().unlock();
        }
    }
Counts all users that are in at least one room.

@return a user count
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/OccupantManager.java