We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
目前Cffu提供的catching方法可以比CompletableFuture的exceptionally方法更细化的针对准确类型的非包装类的异常进行细节处理。但是入参必须是已经从CompletableFuture转为Cffu的实例。
Cffu failed = cffuFactory.failedFuture(new IndexOutOfBoundsException()); System.out.println(CompletableFutureUtils.catching(failed,RuntimeException.class, ex -> 2).get()); System.out.println(CompletableFutureUtils.catching(failed,IndexOutOfBoundsException.class, ex -> 3).get());
但是入参如果是一个未被转化的CompletableFuture异常,该异常会被包装,在此情形下能否兼容处理呢?
CompletableFuture failed = CompletableFuture.supplyAsync(()->{ throw new IndexOutOfBoundsException(); }); System.out.println(CompletableFutureUtils.catching(failed,RuntimeException.class, ex -> 2).get()); System.out.println(CompletableFutureUtils.catching(failed,IndexOutOfBoundsException.class, ex -> 3).get());
可以参考Guava的catching能够准确处理
ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)); ListenableFuture listenableFuture = executorService.submit(()->{ throw new UnsupportedOperationException("s"); }); System.out.println(Futures.catching(listenableFuture,RuntimeException.class, ex -> 2).get()); System.out.println(Futures.catching(listenableFuture,IndexOutOfBoundsException.class, ex -> 3).get());
The text was updated successfully, but these errors were encountered:
No branches or pull requests
目前Cffu提供的catching方法可以比CompletableFuture的exceptionally方法更细化的针对准确类型的非包装类的异常进行细节处理。但是入参必须是已经从CompletableFuture转为Cffu的实例。
但是入参如果是一个未被转化的CompletableFuture异常,该异常会被包装,在此情形下能否兼容处理呢?
可以参考Guava的catching能够准确处理
The text was updated successfully, but these errors were encountered: