Exception during Callable execution

被刻印的时光 ゝ 提交于 2019-12-05 10:00:39
Victor Sorokin

When you call Future.get() it will throw your exception wrapped in a ExecutionException.

As stated in the documentation, Future<V> will re-throw the exception that occurred during .call() (though wrapped in an ExecutionException), and isCancelled() would still be false in this case.

In Guava Librairies, there is a FutureCallback interface which has a onFailure(Throwable t) method which should interest you

Adding Google Guava Librairies to a project is never a waste of space :-)

submit.get() will throw an ExecutionException

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!