public class QuorumFuturesFactory extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QuorumFuturesFactory.CompositeFuture<R> |
Constructor and Description |
---|
QuorumFuturesFactory() |
Modifier and Type | Method and Description |
---|---|
static <R> QuorumFuturesFactory.CompositeFuture<R> |
getQuorumFuture(Comparator<R> comparator,
CompletableFuture<R>[] futures,
Class... failFastThrowables)
Get a thread safe future that will complete only when n/2+1 futures complete or if there
is no hope (if n/2+1 futures are canceled or have conflicting value).
|
public static <R> QuorumFuturesFactory.CompositeFuture<R> getQuorumFuture(Comparator<R> comparator, CompletableFuture<R>[] futures, Class... failFastThrowables)
The future returned does not block explicitly, it aggregates the futures and delegates the blocking.
In case of normal execution, any of the compete futures can be used to return the result. In case of termination, the cancel flag will be updated and if any of the futures threw an exception, ExecutionException will be thrown, otherwise the future will return null.
comparator
- Any comparator consistent with equals that is able to distinguish the
resultsfutures
- The N futuresfailFastThrowables
- list of exceptions that will cause the future to complete
immediately. All fail fast exceptions are directly propagated and
thrown outside.Copyright © 2019 CorfuDB. All rights reserved.