io.vertx.core.Promise#tryFail ( )源码实例Demo

下面列出了io.vertx.core.Promise#tryFail ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private Handler<Throwable> getErrorHandler(Promise future) {
  return t -> {
    if (future != null) {
      future.tryFail(t);
    } else {
      LOGGER.error(t);
    }
  };
}
 
源代码2 项目: hono   文件: HonoConnectionImpl.java
private void onLinkEstablishmentTimeout(
        final ProtonLink<?> link,
        final ClientConfigProperties clientConfig,
        final Promise<?> result) {

    if (link.isOpen() && !HonoProtonHelper.isLinkEstablished(link)) {
        log.info("link establishment [peer: {}] timed out after {}ms",
                clientConfig.getHost(), clientConfig.getLinkEstablishmentTimeout());
        link.close();
        // don't free the link here - this may result in an inconsistent session state (see PROTON-2177)
        // instead the link will be freed when the detach from the server is received
        result.tryFail(new ServerErrorException(HttpURLConnection.HTTP_UNAVAILABLE));
    }
}
 
源代码3 项目: prebid-server-java   文件: BasicHttpClient.java
private static void failResponse(Throwable exception, Promise<HttpClientResponse> promise) {
    promise.tryFail(exception);
}