OF-2498: Optimize OccupantManager#registerActivity
Whenever any occupant sends some kind of stanza, a 'last activity' timestamp is being updated in OccupantManager. This process should be efficient, but has not been.
This commit introduces a lookup by JID for the occupant to be updated. This replaces a strategy where all occupants were iterated over to find the correct item to update.
OF-2498: Speed up MUCRoom cache size calculation
To calculate the cache size of a MUC room instance, the pre-existing calculation iterated over all messages that it was maintaining as part of the message history strategy. This is a very resource intensive way of calculating the cache size. This commit replaces this with a hardcoded size that is roughly equal to having 25 messages kept in history. This reduces the occuracy of the calculated value, but improves the calculation time dramatically.
OF-2498: Reduce MUCRole cache size calculations
Whenever a MUCRole instance is being added to a cache, its size is being calculated. This is rather resource intensive.
MUCRole instances are largely immutable: the cache size is unlikely to change a lot. To reduce the amount of recalculations, this change retains the last calculated size for an instance, resetting it only when a change has been applied.