This is an automated email from the ASF dual-hosted git repository.
mattisonchao pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.9 by this push:
new 157056764dd [fix][common] Add back FutureUtil#waitForAll and
FutureUtil#waitForAny methods with List parameter (#16794)
157056764dd is described below
commit 157056764dd6a9170f80cf89c93c07ec188d4bb5
Author: Qiang Zhao <[email protected]>
AuthorDate: Wed Jul 27 07:46:33 2022 +0800
[fix][common] Add back FutureUtil#waitForAll and FutureUtil#waitForAny
methods with List parameter (#16794)
---
.../org/apache/pulsar/common/util/FutureUtil.java | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git
a/pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java
b/pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java
index d35a6b405b2..51c6087558a 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java
@@ -20,6 +20,7 @@ package org.apache.pulsar.common.util;
import java.time.Duration;
import java.util.Collection;
+import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
@@ -37,6 +38,19 @@ import java.util.stream.Collectors;
*/
public class FutureUtil {
+ /**
+ * Return a future that represents the completion of the futures in the
provided List.
+ * This method with the List parameter is needed to keep compatibility
with external
+ * applications that are compiled with Pulsar < 2.10.0.
+ *
+ * @param futures futures to wait for
+ * @return a new CompletableFuture that is completed when all of the given
CompletableFutures complete
+ */
+ @Deprecated
+ public static CompletableFuture<Void> waitForAll(List<? extends
CompletableFuture<?>> futures) {
+ return CompletableFuture.allOf(futures.toArray(new
CompletableFuture[0]));
+ }
+
/**
* Return a future that represents the completion of the futures in the
provided Collection.
*
@@ -47,6 +61,19 @@ public class FutureUtil {
return CompletableFuture.allOf(futures.toArray(new
CompletableFuture[0]));
}
+ /**
+ * Return a future that represents the completion of any future in the
provided List.
+ * This method with the List parameter is needed to keep compatibility
with external
+ * applications that are compiled with Pulsar < 2.10.0.
+ *
+ * @param futures futures to wait any
+ * @return a new CompletableFuture that is completed when any of the given
CompletableFutures complete
+ */
+ @Deprecated
+ public static CompletableFuture<Object> waitForAny(List<? extends
CompletableFuture<?>> futures) {
+ return CompletableFuture.anyOf(futures.toArray(new
CompletableFuture[0]));
+ }
+
/**
* Return a future that represents the completion of any future in the
provided Collection.
*