denis-chudov commented on code in PR #7009:
URL: https://github.com/apache/ignite-3/pull/7009#discussion_r2542442036
##########
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:
Now the exception in any `whenComplete` closure may be propagated to watch
listener and trigger failure handler, is it exactly what we want?
--
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]