zjureel commented on code in PR #19380:
URL: https://github.com/apache/flink/pull/19380#discussion_r974068617
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionManager.java:
##########
@@ -104,12 +192,40 @@ public void shutdown() {
registeredPartitions.clear();
+ requestPartitionNotifiers.clear();
+
isShutdown = true;
LOG.debug("Successful shutdown.");
}
}
+ /**
+ * Check whether the partition notifier is timeout.
+ */
+ private void checkRequestPartitionNotifiers() {
+ List<PartitionRequestNotifier> timeoutPartitionRequestNotifiers = new
LinkedList<>();
+ synchronized (registeredPartitions) {
+ if (isShutdown) {
+ return;
+ }
+ long now = System.currentTimeMillis();
+ Iterator<Map.Entry<ResultPartitionID,
InputRequestNotifierManager>> iterator =
requestPartitionNotifiers.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<ResultPartitionID, InputRequestNotifierManager>
entry = iterator.next();
+ InputRequestNotifierManager partitionRequestNotifiers =
entry.getValue();
+ partitionRequestNotifiers.removeExpiration(now,
partitionNotifierTimeout.toMillis(), timeoutPartitionRequestNotifiers);
+ if (partitionRequestNotifiers.isEmpty()) {
+ iterator.remove();
+ }
+ }
+ }
+ for (PartitionRequestNotifier partitionRequestNotifier :
timeoutPartitionRequestNotifiers) {
+ partitionRequestNotifier.notifyPartitionRequestTimeout();
+ }
+
partitionNotifierTimeoutChecker.schedule(this::checkRequestPartitionNotifiers,
partitionNotifierTimeout.toMillis(), TimeUnit.MILLISECONDS);
Review Comment:
Done, use rpc scheduled executor instead
--
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]