我是靠谱客的博主 愤怒烧鹅,最近开发中收集的这篇文章主要介绍The Java™ Tutorials — Concurrency :ExecutorsThe Java™ Tutorials — Concurrency :Executors,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

The Java™ Tutorials — Concurrency :Executors

原文地址:https://docs.oracle.com/javase/tutorial/essential/concurrency/executors.html

关键点

  • Executor 接口定义了executor对象的三种类型
  • 线程池是最常见的一种executor实现
  • Fork/Join 是充分利用了多处理器的一种新架构(于 JDK 7 中推出)

全文翻译

In all of the previous examples, there’s a close connection between the task being done by a new thread, as defined by its Runnable object, and the thread itself, as defined by a Thread object. This works well for small applications, but in large-scale applications, it makes sense to separate thread management and creation from the rest of the application. Objects that encapsulate these functions are known as executors. The following subsections describe executors in detail.

  • Executor Interfaces define the three executor object types.
  • Thread Pools are the most common kind of executor implementation.
  • Fork/Join is a framework (new in JDK 7) for taking advantage of multiple processors.

在之前的例子中,由新线程正在执行的任务,也就是定义的Runnable对象,和新线程本身,也就是定义的Thread对象,有着很紧密的关系。这在小程序中非常合适,但对于大程序而言,讲线程的管理和创建从程序中抽离出来是更好的。封装此功能的对象被称为executor。下面的这些子章节将会详细讨论Executor。

  • Executor 接口定义了executor对象的三种类型
  • 线程池是最常见的一种executor实现
  • Fork/Join 是充分利用了多处理器的一种新架构(于 JDK 7 中推出)

最后

以上就是愤怒烧鹅为你收集整理的The Java™ Tutorials — Concurrency :ExecutorsThe Java™ Tutorials — Concurrency :Executors的全部内容,希望文章能够帮你解决The Java™ Tutorials — Concurrency :ExecutorsThe Java™ Tutorials — Concurrency :Executors所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部