Package org.jgroups.util
Enum CompletableFutures
- java.lang.Object
-
- java.lang.Enum<CompletableFutures>
-
- org.jgroups.util.CompletableFutures
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CompletableFutures>
public enum CompletableFutures extends java.lang.Enum<CompletableFutures>
Utility class withCompletableFutureandCompletionStageuseful methods.- Since:
- 5.2
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.CompletableFuture<?>NULLprivate static java.util.function.Consumer<?>VOID_CONSUMER
-
Constructor Summary
Constructors Modifier Constructor Description privateCompletableFutures()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.concurrent.CompletableFuture<T>completedNull()AnullcompletedCompletableFuture.static <T> Tjoin(java.util.concurrent.CompletableFuture<T> cf)Waits for theCompletableFutureto complete.static <T> Tjoin(java.util.concurrent.CompletionStage<T> cs)Same asjoin(CompletableFuture)but it receives aCompletionStageas parameter.static CompletableFuturesvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static CompletableFutures[]values()Returns an array containing the constants of this enum type, in the order they are declared.static <T> java.util.function.Consumer<T>voidConsumer()Consumes any value and return aVoid.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final CompletableFutures INSTANCE
-
-
Method Detail
-
values
public static CompletableFutures[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CompletableFutures c : CompletableFutures.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CompletableFutures valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
join
public static <T> T join(java.util.concurrent.CompletionStage<T> cs)
Same asjoin(CompletableFuture)but it receives aCompletionStageas parameter.- See Also:
join(CompletableFuture)
-
join
public static <T> T join(java.util.concurrent.CompletableFuture<T> cf)
Waits for theCompletableFutureto complete.Any non
RuntimeExceptionthrown is converted to aRuntimeException.- Type Parameters:
T- The value type.- Parameters:
cf- TheCompletableFuture- Returns:
- The value of the completed
CompletableFuture.
-
completedNull
public static <T> java.util.concurrent.CompletableFuture<T> completedNull()
AnullcompletedCompletableFuture.- Type Parameters:
T- The value type.- Returns:
- The
CompletableFuture.
-
voidConsumer
public static <T> java.util.function.Consumer<T> voidConsumer()
Consumes any value and return aVoid.- Type Parameters:
T- The value type.- Returns:
- The
Consumer.
-
-