OF-2531: Remove unneeded JID-based lock in MUC
To fix https://igniterealtime.atlassian.net/browse/OF-1649 a user/JID-based lock was introduced. This lock made the creation of a user-and-joining-a-room atomic with respect to the cleanup action remove-all-users-that-are-not-in-any-room.
OF-2530: Optimize MUC Message History cache usage
When reading or writing cached MUC messages, the entire collection of messages is serialized between cluster nodes. This adds an unacceptable amount of overhead, for every message that is added.
In this commit, the singular cached entity (a list of messages), is separated into two parts:
- A cached entity that represents a list of message references per chatroom
- messages, by reference
The purpose of this is to optimize the scenario of adding a message (which is expected to happen more frequently than reading the history). By having to update only a list of references, instead of a list of actual objects, the amount of data that is to be operated on is reduced significantly.