Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

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;
Expand All @@ -37,6 +38,19 @@
*/
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.
*
Expand All @@ -47,6 +61,19 @@ public static CompletableFuture<Void> waitForAll(Collection<? extends Completabl
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.
*
Expand Down