You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sanpwc (via GitHub)" <gi...@apache.org> on 2023/05/08 14:43:55 UTC

[GitHub] [ignite-3] sanpwc commented on a diff in pull request #2029: IGNITE-18859 PartitionReplicaListener refactoring

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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org