Java并发编程

  • 使用ExecutorService+Callable
    • ExecutorService executor = Executors.newFixedThreadPool(4);
    • executor.invokeAll(xxxList.stream().map(Task:new).collect(Collectors.toList()));
    • class Task implements Callable {@Override public Xxx call() throws Exception { // operations }}

posted on 2021-04-25 16:39  碎羽love星谊  阅读(20)  评论(0编辑  收藏  举报

导航