The Java™ Tutorials — Concurrency :Thread Objects 线程对象

The Java™ Tutorials — Concurrency :Thread Objects 线程对象

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

关键点

  • 线程管理的抽离:利用Executor
  • 实现线程管理的直接控制:线程和异步任务的配套创建

全文翻译

Each thread is associated with an instance of the class Thread. There are two basic strategies for using Thread objects to create a concurrent application.

  • To directly control thread creation and management, simply instantiate Thread each time the application needs to initiate an asynchronous task.
  • To abstract thread management from the rest of your application, pass the application’s tasks to an executor.

每个线程都和一个Thread类的实例相关联。使用Thread对象创建并发程序时,有两个基本的策略:

  • 为了直接控制线程的创建和管理,每次简单地实例化一个Thread对象时,应用也需要创建一个异步任务。
  • 为了把线程管理从你应用的其他部分抽象出来,你需要把应用的任务传给一个executor对象

This section documents the use of Thread objects. Executors are discussed with other high-level concurrency objects.

本章节记录了Thread对象的使用。Executor会同其他高版本并发编程对象一起讨论。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值