SammyVimes commented on code in PR #1579:
URL: https://github.com/apache/ignite-3/pull/1579#discussion_r1087556788


##########
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java:
##########
@@ -908,6 +909,32 @@ public static <T> List<T> collectStaticFields(Class<?> 
sourceCls, Class<? extend
         return result;
     }
 
+    /**
+     * Cancels the future and runs a consumer on future's result if it was 
completed before the cancellation.
+     * Does nothing if future is cancelled or completed exceptionally.
+     *
+     * @param future Future.
+     * @param consumer Consumer that accepts future's result.
+     * @param <T> Future's result type.
+     */
+    public static <T> void cancelOrConsume(CompletableFuture<T> future, 
Consumer<T> consumer) {
+        assert future != null;

Review Comment:
   ok, how about `@Contract("null -> fail")`?



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