io.trane.future.Future.onSuccess()方法的使用及代码示例

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

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

Future.onSuccess介绍

[英]Executes the Consumer if this future completes successfully.
[中]如果此future成功完成,则执行使用者。

代码示例

代码示例来源:origin: traneio/future

@Override
 final Future<T> apply(final Future<T> result) {
  return result.onSuccess(c);
 }
}

代码示例来源:origin: traneio/ndbc

protected final <T> CompletionStage<T> conv(final Future<T> fut) {
 final CompletableFuture<T> cf = new CompletableFuture<>();
 fut.onSuccess(cf::complete).onFailure(cf::completeExceptionally);
 return cf;
}

代码示例来源:origin: traneio/ndbc

protected final <T> Future<T> convert(final io.trane.future.Future<T> future) {
 final Promise<T> promise = Promise$.MODULE$.apply();
 future.onSuccess(promise::success).onFailure(promise::failure);
 return promise.future();
}

代码示例来源:origin: traneio/ndbc

protected final <T> Future<T> convert(final io.trane.future.Future<T> future) {
 final Promise<T> promise = Promise$.MODULE$.apply();
 future.onSuccess(promise::success).onFailure(promise::failure);
 return promise.future();
}

代码示例来源:origin: traneio/ndbc

protected final <T> Future<T> convert(final io.trane.future.Future<T> future) {
 final Promise<T> promise = Promise.apply();
 promise.setInterruptHandler(new PartialFunction<Throwable, BoxedUnit>() {
  @Override
  public BoxedUnit apply(final Throwable v1) {
   future.raise(v1);
   return BoxedUnit.UNIT;
  }
  @Override
  public boolean isDefinedAt(final Throwable x) {
   return true;
  }
 });
 future.onSuccess(promise::setValue).onFailure(promise::setException);
 return promise;
}

代码示例来源:origin: traneio/ndbc

return channel.ctx().onSuccess(ctx -> {
 final SSLEngine sslEngine = sslContext.newEngine(ctx.alloc(), host, port);
 if (cfg.mode() == Mode.VERIFY_FULL) {

相关文章