fredia commented on code in PR #24698:
URL: https://github.com/apache/flink/pull/24698#discussion_r1582032431


##########
flink-core/src/main/java/org/apache/flink/core/state/StateFutureImpl.java:
##########
@@ -61,23 +66,34 @@ public <U> StateFuture<U> thenApply(Function<? super T, ? 
extends U> fn) {
                 return StateFutureUtils.completedFuture(r);
             } else {
                 StateFutureImpl<U> ret = makeNewStateFuture();
-                completableFuture.thenAccept(
-                        (t) -> {
-                            callbackRunner.submit(
-                                    () -> {
-                                        ret.complete(fn.apply(t));
-                                        callbackFinished();
-                                    });
-                        });
+                completableFuture
+                        .thenAccept(
+                                (t) -> {
+                                    callbackRunner.submit(
+                                            () -> {
+                                                ret.complete(fn.apply(t));
+                                                callbackFinished();
+                                            });
+                                })
+                        .exceptionally(

Review Comment:
   `exceptionally` and `try/catch` are equivalent, this is an explanation 
regarding `exceptionally`. I prefer writing it in terms of `exceptionally` to 
reduce nested levels.
   
   > Returns a new CompletableFuture that is completed when this 
CompletableFuture completes, with the result of the given function of the 
exception triggering this CompletableFuture's completion when it completes 
exceptionally; otherwise, if this CompletableFuture completes normally, then 
the returned CompletableFuture also completes normally with the same value



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

Reply via email to