@ExperimentalApi
public class VCacheUtils
extends java.lang.Object
| Constructor and Description |
|---|
VCacheUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T,R> R |
fold(java.util.concurrent.CompletionStage<T> stage,
java.util.function.BiFunction<T,java.lang.Throwable,R> fn)
Syntactic sugar for writing
stage.handle(fn).toCompletableFuture().unsafeJoin(). |
static <T,R> R |
fold(java.util.concurrent.CompletionStage<T> stage,
java.util.function.Function<T,R> success,
java.util.function.Function<java.lang.Throwable,R> failure)
Syntactic sugar for handling the result (either success or failure) from a
CompletionStage. |
static <V> V |
join(java.util.concurrent.CompletionStage<V> stage)
Deprecated.
since 1.5.0 - use
unsafeJoin(CompletionStage) instead (if you must). |
static <V> V |
unsafeJoin(java.util.concurrent.CompletionStage<V> stage)
Syntactic sugar for writing
stage.toCompletableFuture().unsafeJoin(). |
@Deprecated public static <V> V join(java.util.concurrent.CompletionStage<V> stage)
unsafeJoin(CompletionStage) instead (if you must).stage.toCompletableFuture().unsafeJoin(). This method should not be used
in production code, as it should be resilient to cache failures.V - the value typestage - the stage to call CompletableFuture.join() onCompletableFuture.join(),
unsafeJoin(CompletionStage)public static <V> V unsafeJoin(java.util.concurrent.CompletionStage<V> stage)
stage.toCompletableFuture().unsafeJoin(). This method should not be used
in production code, as it should be resilient to cache failures. This method will throw runtime exceptions
if errors occur.V - the value typestage - the stage to call CompletableFuture.join() onCompletableFuture.join()public static <T,R> R fold(java.util.concurrent.CompletionStage<T> stage,
java.util.function.Function<T,R> success,
java.util.function.Function<java.lang.Throwable,R> failure)
CompletionStage.T - the type returned by the stageR - the type to be returnedstage - the stage to handle the resultssuccess - called if the stage returned a successful resultfailure - called if the stage failedpublic static <T,R> R fold(java.util.concurrent.CompletionStage<T> stage,
java.util.function.BiFunction<T,java.lang.Throwable,R> fn)
stage.handle(fn).toCompletableFuture().unsafeJoin().T - the type returned by the stageR - the type to be returnedstage - the stage to handle the resultsfn - called to handle the resultCopyright © 2022 Atlassian. All rights reserved.