OF-2511: Prevent loading unused historic messages for MUC rooms.
Typically, rooms are configured to retain only 25 message of history, to be sent to clients that join a room (note that this does _not_ relate at all to MAM).
When loading a room from the database, Openfire should not load _all_ messages from the database, but only the ones that are potentially going to be sent to clients. For rooms which a large history, this saves a considerable amount of resources.
This commit uses somewhat of a hack that is based on database driver functionality (skipping ahead in the resultset), as opposed to modifying the SQL query that is used to obtain the records. Such modification would likely depend on non-standardized SQL staments (TOP / LIMIT / ROWNUM), which would introduce the need for database-vendor specific code.