【发布时间】:2021-07-05 23:03:30
【问题描述】:
ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor)
Executors.newFixedThreadPool(numThreads);
当我查看 api 文档时,fixedThreadPool() 返回了一个执行器服务实例,但在这里我们将 fixedThreadPool() 转换为 ThreadPoolExecutor,这很奇怪,因为 ThreadPoolExecutor 实现了执行器服务,谁能解释一下这个转换是如何工作的? ?
【问题讨论】:
标签: java multithreading concurrency casting threadpool