本文整理汇总了Java中io.vertx.reactivex.core.Future类的典型用法代码示例。如果您正苦于以下问题:Java Future类的具体用法?Java Future怎么用?Java Future使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Future类属于io.vertx.reactivex.core包,在下文中一共展示了Future类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrievePrice
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
public static void retrievePrice(WebClient pricer, Map.Entry<String, Object> entry, Future<JsonObject> future) {
pricer.post("/prices")
.rxSendJson(new JsonObject()
.put("name", entry.getKey())
.put("quantity", entry.getValue())
).subscribe(
resp -> future.complete(resp.bodyAsJsonObject()),
future::fail
);
}
示例2: toObserver
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
/**
* Utility method to report the completion/failure from a Single to a Future.
*
* @param future the future
* @return the single observer to pass to {@link Single#subscribe()}
*/
public static SingleObserver<JsonObject> toObserver(Future<JsonObject> future) {
return new SingleObserver<JsonObject>() {
public void onSubscribe(@NonNull Disposable d) {
}
public void onSuccess(@NonNull JsonObject item) {
future.tryComplete(item);
}
public void onError(Throwable error) {
future.tryFail(error);
}
};
}
示例3: executeBlocking
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
public static <T> Single<T> executeBlocking(Handler<Future<T>> blockingCodeHandler, Vertx
vertx) {
return vertx.rxExecuteBlocking(blockingCodeHandler);
}
示例4: executeBlockingObservable
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
public static <T> Observable<T> executeBlockingObservable(Handler<Future<List<T>>> blockingCodeHandler, Vertx
vertx) {
return executeBlocking(blockingCodeHandler,vertx)
.flatMapObservable(Observable::fromIterable);
}
示例5: MeshResponse
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
public MeshResponse(io.vertx.core.Future<T> delegate) {
super(delegate);
}
示例6: create
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
public static <T> MeshResponse<T> create() {
return new MeshResponse<T>(io.vertx.core.Future.future());
}
示例7: executeBlockingObservable
import io.vertx.reactivex.core.Future; //导入依赖的package包/类
public static <T> Observable<T> executeBlockingObservable(Handler<Future<List<T>>> blockingCodeHandler, Vertx
vertx) {
return executeBlocking(blockingCodeHandler,vertx)
.flatMapObservable(Observable::fromIterable);
}