ijuma commented on code in PR #13169: URL: https://github.com/apache/kafka/pull/13169#discussion_r1095220913
########## server-common/src/main/java/org/apache/kafka/server/util/FutureUtils.java: ########## @@ -66,4 +67,27 @@ public static <T> T waitWithLogging( throw new RuntimeException("Received a fatal error while waiting for " + action, t); } } + + /** + * Complete a given destination future when a source future is completed. + * + * @param sourceFuture The future to trigger off of. + * @param destinationFuture The future to complete when the source future is completed. + * @param <T> The destination future type. + */ + public static <T> void chainFuture( + CompletableFuture<? extends T> sourceFuture, + CompletableFuture<T> destinationFuture + ) { + sourceFuture.whenComplete(new BiConsumer<T, Throwable>() { + @Override + public void accept(T val, Throwable throwable) { Review Comment: Nit: you can use a lambda instead of an anonymous inner class. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org