public Iterator<Message> getMessageHistory(){
        final LinkedList<Message> list = new LinkedList<>(getHistoryFromCache());
        // Sort messages. Messages may be out of order when running inside of a cluster
        list.sort(new MessageComparator());
        return list.iterator();
    }
Obtain the current history as an iterator of messages to play back to a new room member.

@return An iterator of Message objects to be sent to the new room member.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/HistoryStrategy.java