Zakelly commented on code in PR #24698:
URL: https://github.com/apache/flink/pull/24698#discussion_r1591888669
##########
flink-core/src/main/java/org/apache/flink/core/state/StateFutureImpl.java:
##########
@@ -203,12 +251,29 @@ public void callbackFinished() {
}
@Override
- public void thenSyncAccept(Consumer<? super T> action) {
- completableFuture.thenAccept(action);
+ public void thenSyncAccept(ThrowingConsumer<? super T, ? extends
Exception> action) {
+ completableFuture
+ .thenAccept(ThrowingConsumer.unchecked(action))
+ .exceptionally(
+ (e) -> {
+ exceptionHandler.handleException(
+ "Caught exception when processing
completed StateFuture's callback.",
+ e);
+ return null;
+ });
}
/** The entry for a state future to submit task to mailbox. */
public interface CallbackRunner {
- void submit(Runnable task);
+ void submit(ThrowingRunnable<? extends Exception> task);
+ }
+
+ /**
+ * Handles an exception thrown by callback framework, borrowed idea from
{@code
+ * AsyncExceptionHandler}.
+ */
+ public interface CallbackExceptionHandler {
Review Comment:
I just went though the final commit. It seems the exception handler only
handle the exception from framework? so I'd suggest change this name.
BTW, it seems better to change the name of `StateCallbackException` to
something like `AsyncStateException`
--
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]