@ExperimentalApi public class VCacheUtils extends Object
| Constructor and Description |
|---|
VCacheUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T,R> R |
fold(CompletionStage<T> stage,
BiFunction<T,Throwable,R> fn)
Syntactic sugar for writing
stage.handle(fn).toCompletableFuture().unsafeJoin(). |
static <T,R> R |
fold(CompletionStage<T> stage,
Function<T,R> success,
Function<Throwable,R> failure)
Syntactic sugar for handling the result (either success or failure) from a
CompletionStage. |
static <V> V |
join(CompletionStage<V> stage)
Deprecated.
since 1.5.0 - use
unsafeJoin(CompletionStage) instead (if you must). |
static <V> V |
unsafeJoin(CompletionStage<V> stage)
Syntactic sugar for writing
stage.toCompletableFuture().unsafeJoin(). |
@Deprecated public static <V> V join(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(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(CompletionStage<T> stage, Function<T,R> success, Function<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(CompletionStage<T> stage, BiFunction<T,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 © 2016 Atlassian. All rights reserved.