public void add(Message packet, Type strategyType, int strategyMaxNumber)
        {
            // store message according to active strategy
            if (strategyType == Type.all) {
                history.add(packet);
            } else if (strategyType == Type.number) {
                if (history.size() >= strategyMaxNumber) {
                    // We have to remove messages so the new message won't exceed the max history size.
                    while (!history.isEmpty() && history.size() >= strategyMaxNumber) {
                        history.poll();
                    }
                }
                history.add(packet);
            }
        }
A wrapper for a collection of Message instances that is cached.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/HistoryStrategy.java