RobertIndie commented on code in PR #15454:
URL: https://github.com/apache/pulsar/pull/15454#discussion_r867361866
##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java:
##########
@@ -55,6 +57,36 @@ public static CompletableFuture<Object>
waitForAny(Collection<? extends Completa
return CompletableFuture.anyOf(futures.toArray(new
CompletableFuture[0]));
}
+ public static CompletableFuture<Optional<Object>> waitForAny(Collection<?
extends CompletableFuture<?>> futures,
Review Comment:
Let's write some comments to describe this method clearly.
##########
pulsar-common/src/test/java/org/apache/pulsar/common/util/FutureUtilTest.java:
##########
@@ -136,4 +139,37 @@ public void testGetOriginalException() {
assertTrue(future3Exception.get(0) instanceof
IllegalStateException);
});
}
+
+ @Test
+ public void testWaitForAny() {
Review Comment:
We should also cover the case that other futures could be canceled
successfully before the waitForAny finished.
--
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]