JUC--线程池ThreadPoolExecutor.docVIP

  • 19
  • 0
  • 约2.52万字
  • 约 22页
  • 2017-03-27 发布于重庆
  • 举报
JUC--线程池ThreadPoolExecutor

J.U.C--线程池ThreadPoolExecutor 1. Executor接口以及其子接口 首先来看一下线程池相关类与接口的体系结构图: 上面系很清晰显示了线程池中的常用类和接口之间关系,下面首先看看最基础的Executor接口: public interface Executor { /** * Executes the given command at some time in the future. The command * may execute in a new thread, in a pooled thread, or in the calling * thread, at the discretion of the {@code Executor} implementation. * 翻译: * 1.任务在未来某个时候被执行,即可能execute之后任务不是立刻执行; * 2.任务的执行是在一个新的线程中执行,这个新的线程可能是线程池中的,也可能是被调用的线程。这取决于对Executor的实现 */ void execute(Runnable command); } Executor的子接口ExecutorService增加了一些方法用来更好的支持线程

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档