yunfengzhou-hub commented on code in PR #20275: URL: https://github.com/apache/flink/pull/20275#discussion_r926210804
########## flink-runtime/src/main/java/org/apache/flink/runtime/operators/coordination/CloseableSubtaskGateway.java: ########## @@ -0,0 +1,182 @@ +/* + * 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.operators.coordination; + +import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor; +import org.apache.flink.runtime.executiongraph.ExecutionAttemptID; +import org.apache.flink.runtime.messages.Acknowledge; +import org.apache.flink.util.concurrent.FutureUtils; + +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +/** + * An {@link org.apache.flink.runtime.operators.coordination.OperatorCoordinator.SubtaskGateway} + * that can be temporarily closed, blocking events from going through, buffering them, and releasing + * them later. It is used for "alignment" of operator event streams with checkpoint barrier + * injection, similar to how the input channels are aligned during a common checkpoint. + * + * <p>This class is NOT thread safe, but assumed to be used in a single threaded context. To guard + * that, one can register a "main thread executor" (as used by the mailbox components like RPC + * components) via {@link #setMainThreadExecutorForValidation(ComponentMainThreadExecutor)}. + */ +class CloseableSubtaskGateway implements OperatorCoordinator.SubtaskGateway { Review Comment: As raised in a comment below, I agree that the closing/reopening behavior is needed by all subtask gateway implementations, so I'll remove this class and merge its functions to `SubtaskGatewayImpl`. In that case, this comment would not be applicable. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
