OF-2292: Prevent ConcurrentModificationException when syncing clustered MUC occupants
This creates a copy of a collection over which is being operated, to prevent the collection to be modified while being iterated over.
OF-2290 / OF-2278: Per-cache locks
Locks that are obtained from a cache are though to refer to the key value of an entry. A lock should:
- be unique to a cache (eg: when acquiring a lock for cache A, it should not interfere with operations on cache B)
- based on equals and hashcode, not equality by reference (==). For example: caches that use JIDs are they key typically use different but equal instances of the same JID value.