vldpyatkov commented on code in PR #7009:
URL: https://github.com/apache/ignite-3/pull/7009#discussion_r2542481506


##########
modules/core/src/main/java/org/apache/ignite/internal/causality/BaseVersionedValue.java:
##########
@@ -378,18 +383,22 @@ public void removeWhenDelete(DeletionListener<T> action) {
     /**
      * Notifies completion listeners.
      */
-    private void notifyCompletionListeners(long causalityToken, 
CompletableFuture<T> future) {
-        future.whenComplete((v, t) -> {
+    private CompletableFuture<Void> notifyCompletionListeners(long 
causalityToken, CompletableFuture<T> future) {
+        return future.handle((v, t) -> {
             Throwable unpackedThrowable = t instanceof CompletionException ? 
t.getCause() : t;
 
+            ArrayList<CompletableFuture<?>> futs = new ArrayList<>();
+
             for (CompletionListener<T> listener : completionListeners) {
                 try {
-                    listener.whenComplete(causalityToken, v, 
unpackedThrowable);
+                    futs.add(listener.whenComplete(causalityToken, v, 
unpackedThrowable));
                 } catch (Exception e) {
                     log.error("Exception when notifying a completion 
listener", e);
                 }
             }
-        });
+
+            return CompletableFutures.allOf(futs);
+        }).thenCompose(identity());

Review Comment:
   I think, that is.
   The method is used only for internal code; if the closure can be a source of 
exceptional behavior, we can wrap it in a try-catch block.



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