sanpwc commented on code in PR #2029:
URL: https://github.com/apache/ignite-3/pull/2029#discussion_r1187534457


##########
modules/core/src/main/java/org/apache/ignite/internal/util/PendingComparableValuesTracker.java:
##########
@@ -161,8 +171,38 @@ public void close() {
 
         TrackerClosedException trackerClosedException = new 
TrackerClosedException();
 
-        valueFutures.values().forEach(future -> 
future.completeExceptionally(trackerClosedException));
+        completeWaitersOnClose(trackerClosedException);
 
         valueFutures.clear();
     }
+
+    protected void completeWaitersOnUpdate(T newValue, @Nullable R 
futureResult) {
+        ConcurrentNavigableMap<T, CompletableFuture<R>> smallerFutures = 
valueFutures.headMap(newValue, true);
+
+        smallerFutures.forEach((k, f) -> f.complete(futureResult));
+
+        smallerFutures.clear();

Review Comment:
   Because all that futures are guaranteed to be completed and there's no sense 
in having them any longer. BTW it's a part of the original code.



-- 
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]

Reply via email to