protected void addHistoryEntry()

in src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncHistory.java [55:81]


    protected void addHistoryEntry(BaseTopologyView view, String msg) {
        synchronized(history) {
            for(int i = history.size() - 1; i>=0; i--) {
                HistoryEntry entry = history.get(i);
                if (!entry.view.equals(view)) {
                    // don't filter if the view starts differing,
                    // only filter for the last few entries where
                    // the view is equal
                    break;
                }
                if (entry.msg.equals(msg)) {
                    // if the view is equal and the msg matches
                    // then this is a duplicate entry, so ignore
                    return;
                }
            }
            String fullLine = sdf.format(Calendar.getInstance().getTime()) + ": " + msg;
            HistoryEntry newEntry = new HistoryEntry();
            newEntry.view = view;
            newEntry.fullLine = fullLine;
            newEntry.msg = msg;
            history.add(newEntry);
            while (history.size() > 12) {
                history.remove(0);
            }
        }
    }