RocMarshal commented on code in PR #23635: URL: https://github.com/apache/flink/pull/23635#discussion_r1426516597
########## flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/DefaultDeclarativeSlotPool.java: ########## @@ -127,7 +155,28 @@ public void increaseResourceRequirementsBy(ResourceCounter increment) { } totalResourceRequirements = totalResourceRequirements.add(increment); + if (slotRequestMaxInterval == null) { + declareResourceRequirements(); + return; + } + + Preconditions.checkNotNull(componentMainThreadExecutor); + if (slotRequestMaxIntervalTimeoutCheckFuture != null) { + slotRequestMaxIntervalTimeoutCheckFuture.cancel(true); + } + slotRequestMaxIntervalTimeoutCheckFuture = + componentMainThreadExecutor.schedule( + this::checkSlotRequestMaxIntervalTimeout, + slotRequestMaxInterval.toMilliseconds(), + TimeUnit.MILLISECONDS); + } + + private void checkSlotRequestMaxIntervalTimeout() { + if (componentMainThreadExecutor == null || slotRequestMaxInterval == null) { Review Comment: nice idea! How about `When assigning values in the construction method, we do some checks and only allow these two parameters to be both empty or not empty at the same time` ? Or use `Precondition.checkState/Args` to check it ? Because we only need this `componentMainThreadExecutor ` when allowing requests resources by batch. Looking forward to better handlings. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org