zhijiangW commented on a change in pull request #9993:
[FLINK-14498][runtime]Introduce NetworkBufferPool#isAvailable() for interacting
with LocalBufferPool.
URL: https://github.com/apache/flink/pull/9993#discussion_r338958281
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
##########
@@ -205,14 +236,26 @@ public void
recycleMemorySegments(Collection<MemorySegment> segments) throws IOE
}
private void recycleMemorySegments(Collection<MemorySegment> segments,
int size) throws IOException {
+ CompletableFuture<?> toNotify = null;
synchronized (factoryLock) {
numTotalRequiredBuffers -= size;
- availableMemorySegments.addAll(segments);
+ synchronized (availabilityHelper) {
+ if (availableMemorySegments.isEmpty() &&
!segments.isEmpty()) {
+ toNotify =
availabilityHelper.getUnavailableToResetAvailable();
+ }
+ availableMemorySegments.addAll(segments);
+ if (toNotify != null) {
Review comment:
It can always call `availabilityHelper.notifyAll();`, because even though
this condition is true it does not mean above `availabilityHelper.wait(2000);`
is happening.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services