@Override
    public void userDeleting(User user, Map<String, Object> params)
    {
        // When a user is being deleted, all its affiliations need to be removed from chat rooms (OF-2166). Note that
        // this event handler only works for rooms that are loaded into memory from the database. Corresponding code
        // in MultiUserChatManager will remove affiliations from rooms that are not in memory, but only in the database.
        final JID userJid = XMPPServer.getInstance().createJID(user.getUsername(), null);

        final Lock lock = getMUCService().getChatRoomLock(getJID().getNode());
        try {
            lock.lock();

            if (getAffiliation(userJid) == Affiliation.none) {
                // User had no affiliation with this room.
                return;
            }

            // Cannot remove the last owner of a chat room. To prevent issues, replace the owner with an administrative account.
            if (getOwners().contains(userJid) && getOwners().size() == 1) {
                final JID adminJid = XMPPServer.getInstance().getAdmins().iterator().next();
                Log.info("User '{}' is being deleted, but is also the only owner of MUC room '{}'. To prevent having a room without owner, server admin '{}' was made owner of the room.", user.getUsername(), getJID(), adminJid);
                addOwner(adminJid, getSelfRepresentation().getAffiliation());
            }

            // Remove the affiliation of the deleted user with the room
            addNone(userJid, getSelfRepresentation().getAffiliation());
            getMUCService().syncChatRoom(this);
        } catch (Throwable t) {
            Log.warn("A problem occurred while trying to update room '{}' as a result of user '{}' being deleted from Openfire.", getJID(), user);
        } finally {
            lock.unlock();
        }
    }
Saves the room configuration to the DB. After the room has been saved to the DB it will
become persistent.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java