java.util.concurrent.ExecutionException.addSuppressed()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(118)

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

ExecutionException.addSuppressed介绍

暂无

代码示例

代码示例来源:origin: lettuce-io/lettuce-core

@Override
public <U> ConnectionFuture<U> thenCompose(BiFunction<? super T, ? super Throwable, ? extends CompletionStage<U>> fn) {
  CompletableFuture<U> future = new CompletableFuture<>();
  delegate.whenComplete((v, e) -> {
    try {
      CompletionStage<U> apply = fn.apply(v, e);
      apply.whenComplete((u, t) -> {
        if (t != null) {
          future.completeExceptionally(t);
        } else {
          future.complete(u);
        }
      });
    } catch (Exception ex) {
      ExecutionException result = new ExecutionException("Exception while applying thenCompose", ex);
      if (e != null) {
        result.addSuppressed(e);
      }
      future.completeExceptionally(result);
    }
  });
  return adopt(future);
}

代码示例来源:origin: neo4j/neo4j

for ( Throwable failure : failures )
  exception.addSuppressed( failure );

代码示例来源:origin: io.lettuce/lettuce-core

@Override
public <U> ConnectionFuture<U> thenCompose(BiFunction<? super T, ? super Throwable, ? extends CompletionStage<U>> fn) {
  CompletableFuture<U> future = new CompletableFuture<>();
  delegate.whenComplete((v, e) -> {
    try {
      CompletionStage<U> apply = fn.apply(v, e);
      apply.whenComplete((u, t) -> {
        if (t != null) {
          future.completeExceptionally(t);
        } else {
          future.complete(u);
        }
      });
    } catch (Exception ex) {
      ExecutionException result = new ExecutionException("Exception while applying thenCompose", ex);
      if (e != null) {
        result.addSuppressed(e);
      }
      future.completeExceptionally(result);
    }
  });
  return adopt(future);
}

代码示例来源:origin: jenkinsci/pipeline-aws-plugin

e.addSuppressed(throwable);

相关文章