Java并发 -- Future
ThreadPoolExecutor
1 | // 无法获取任务的执行结果 |
Future
1 | // 取消任务 |
1 | ExecutorService pool = Executors.newFixedThreadPool(1); |
FutureTask
1 | // 继承关系 |
1 | // 线程池 |
1 | // 手动创建线程 |
烧水泡茶
1 | // 创建两个FutureTask,ft1和ft2 |
参考资料
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.