Vertx: Future异步操作设计
Future相关操作的设计
AsyncResult
AsyncResult表示一个异步操作的结果,这个结果要么是成功的,要么是失败的。
interface AsyncResult<T> {
T getResult();
Throwable cause();
boolean succeeded();
boolean failed();
AsyncResult<V> map(Function<T, V> mapper);
AsyncResult<V> map(V value);
AsyncResult<V> mapEmpty();
AsyncResult<T> otherwise(T value);
AsyncResult<T> otherwise(Function<Throwable, T> mapper);
AsyncResult<T> otherwiseEmpty();
}