AHeise commented on a change in pull request #11507: [FLINK-16587] Add basic CheckpointBarrierHandler for unaligned checkpoint URL: https://github.com/apache/flink/pull/11507#discussion_r402784483
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/PriorityEventListener.java ########## @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition; + +import org.apache.flink.runtime.event.AbstractEvent; +import org.apache.flink.runtime.io.network.buffer.BufferConsumer; + +import java.io.IOException; + +/** + * Listens to priority events (e.g., checkpoint barriers) of subpartitions. The listener can completely process the + * event without the buffer queue or let the subpartition enqueue the event in the front or back of the buffer queue. + */ +public interface PriorityEventListener { + /** + * Allows the listener to react to a priority event independent of the outgoing buffer queue. + * + * @return the action to be performed by the caller. + */ + EventAction priorityEvent(AbstractEvent event, BufferConsumer eventBufferConsumer) throws IOException; + + /** + * The action to be performed by the caller of the {@link PriorityEventListener}. + */ + enum EventAction { + /** + * The event should be added in the front of the buffer queue (to be consumed next). + */ + ENQUEUE_AS_FIRST_BUFFER, + /** + * The event should be added in the back of the buffer queue (to be consumed last). + */ + ENQUEUE_AS_LAST_BUFFER, + /** + * The event was already handled and should not be added to the buffer queue at all. + */ + DONT_INSERT Review comment: For a different change, I removed `LAST` and just renamed the remaining option to `ENQUEUE`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services