为什么未来.isDone()一定要在之后executorService.sutdown()。
这可以工作:
Future<Integer> submit1 = executorService.submit(callable);
executorService.shutdown();
while (submit1.isDone()){
System.out.println(submit1.get());
}
但在我评论这一行之后:
Future<Integer> submit1 = executorService.submit(callable);
//executorService.shutdown();
while (submit1.isDone()){
System.out.println(submit1.get());
}
它无法打印任何结果。
函数式编程
largeQ
相关分类