io.vertx.core.Future.otherwiseEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中io.vertx.core.Future.otherwiseEmpty()方法的一些代码示例,展示了Future.otherwiseEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Future.otherwiseEmpty()方法的具体详情如下:
包路径:io.vertx.core.Future
类名称:Future
方法名:otherwiseEmpty

Future.otherwiseEmpty介绍

[英]Map the failure of a future to null.

This is a convenience for future.otherwise((T) null).

When this future fails, the null value will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.
[中]将未来的失败映射为空。
这是未来的便利。否则((T)null)。
当此future失败时,null值将完成此方法调用返回的future。
当此未来成功时,结果将传播到返回的未来。

代码示例

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Map the failure of a future to <code>null</code>.<p>
 *
 * This is a convenience for <code>future.otherwise((T) null)</code>.<p>
 *
 * When this future fails, the <code>null</code> value will complete the future returned by this method call.<p>
 *
 * When this future succeeds, the result will be propagated to the returned future.
 * @return the mapped future
 */
public io.vertx.rxjava.core.Future<T> otherwiseEmpty() { 
 io.vertx.rxjava.core.Future<T> ret = io.vertx.rxjava.core.Future.newInstance(delegate.otherwiseEmpty(), __typeArg_0);
 return ret;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Map the failure of a future to <code>null</code>.<p>
 *
 * This is a convenience for <code>future.otherwise((T) null)</code>.<p>
 *
 * When this future fails, the <code>null</code> value will complete the future returned by this method call.<p>
 *
 * When this future succeeds, the result will be propagated to the returned future.
 * @return the mapped future
 */
public io.vertx.rxjava.core.Future<T> otherwiseEmpty() { 
 io.vertx.rxjava.core.Future<T> ret = io.vertx.rxjava.core.Future.newInstance(delegate.otherwiseEmpty(), __typeArg_0);
 return ret;
}

代码示例来源:origin: eclipse/hono

/**
   * Closes the connection to the AMQP Messaging Network.
   * 
   * @return A future that successfully completes once the connection is closed.
   */
  public CompletableFuture<Void> close() {

    final CompletableFuture<Void> result = new CompletableFuture<>();
    final Future<Void> clientTracker = Future.future();
    amqpNetworkClient.shutdown(clientTracker.completer());
    clientTracker.otherwiseEmpty().compose(ok -> closeVertx()).setHandler(attempt -> result.complete(null));
    return result;
  }
}

代码示例来源:origin: eclipse/hono

honoTracker.otherwiseEmpty(),
      registrationServiceTracker.otherwiseEmpty()
      ).compose(ok -> closeVertx()).setHandler(done -> shutdown.complete(null));
} else {

相关文章