public synchronized void foreach(final Consumer<TimerTask> consumer) {
        TimerTaskEntry entry = root.next;
        while (entry != root) {
            TimerTaskEntry next = entry.next;
            if (!entry.cancelled()) {
                consumer.accept(entry.timerTask);
            }
            entry = next;
        }
    }
Traversing using this is thread-safe.

@param consumer the consumer
shenyu-common/src/main/java/org/apache/shenyu/common/timer/TimerTaskList.java