处理ExecutorService中的异常Exception

走着路睡觉
  • java
小于 1 分钟

Callable task = ...
Future future = executor.submit(task);
// do something else in the meantime, and then...
try {
   future.get();
} catch (ExecutionException ex) {
   ex.getCause().printStackTrace();
}
上次编辑于:
贡献者: zhaojingbo
Loading...