pvary commented on code in PR #16545: URL: https://github.com/apache/iceberg/pull/16545#discussion_r3356074589
########## flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/reader/PoolWithWakeup.java: ########## @@ -0,0 +1,114 @@ +/* + * 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.iceberg.flink.source.reader; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; +import org.apache.flink.connector.file.src.util.Pool; + +/** + * A recyclable object pool similar to Flink's {@link Pool}, but whose blocking {@link #pollEntry()} + * can be unblocked by {@link #wakeUp()} without interrupting the waiting thread. + * + * <p>Flink's shutdown path is cooperative: it calls {@link + * org.apache.flink.connector.base.source.reader.splitreader.SplitReader#wakeUp()} but does not + * interrupt the fetcher thread. A thread parked in Flink's {@code Pool#pollEntry()} therefore never + * returns and the fetcher leaks. This pool lets the fetcher block on an entry while still being + * able to return control when woken up. Review Comment: Maybe remove this. We don't need to describe Flink internals here -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
