boolean canPunctuate(final long timestamp) {
        synchronized (pq) {
            PunctuationSchedule top = pq.peek();
            while (top != null && top.timestamp <= timestamp) {
                if (!top.isCancelled()) {
                    return true;
                }
                // Side-effect: removes cancelled schedules (not externally visible)
                pq.poll();
                top = pq.peek();
            }
            return false;
        }
    }
Returns true if there is a schedule ready to be punctuated.
streams/src/main/java/org/apache/kafka/streams/processor/internals/PunctuationQueue.java