Duration unloadInactiveRooms(@Nonnull final Date cleanUpDate)
    {
        Duration totalChatTime = Duration.ZERO;
        final Set<String> roomNames = getAll().stream().map(MUCRoom::getName).collect(Collectors.toSet());
        for (final String roomName : roomNames) {
            final Lock lock = ROOM_CACHE.getLock(roomName);
            lock.lock();
            try {
                final MUCRoom room = get(roomName);
                if (room != null && room.getEmptyDate() != null && room.getEmptyDate().before(cleanUpDate)) {
                    Log.debug("Unloading chat room (due to inactivity): {}", roomName);
                    remove(roomName);
                    totalChatTime = totalChatTime.plus(Duration.ofMillis(room.getChatLength()));
                }
            } finally {
                lock.unlock();
            }
        }
        return totalChatTime;
    }
Removes rooms that have only been inactive since a certain date from memory. This does not destroy the room: it
can be reloaded from the database on-demand. Note that this method is expected to operate on persistent rooms
only, as non-persistent rooms will be destroyed immediately after the last occupant leaves.

@param cleanUpDate The cut-off date.
@return The total amount of time that the removed rooms had 'chat-time'.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoomManager.java