官术网_书友最值得收藏!

Life cycle

Here's a diagram showing the life cycle of a job:

By default, a job is started as soon as it's created. This happens both when the job is created with launch() and when it's done with Job(). As we will see in a bit, it's possible to create a job without starting it.

There are five states in the diagram:

  • New: A job that exists but is not executing yet.
  • Active: A job that is running. A suspended job is also considered active.
  • Completed: When the job is not executing any longer.
  • Cancelling: When cancel() is called on a Job that is active, it may require time for the cancellation to complete. This is an intermediate state between Active and Cancelled.
  • Cancelled: A job that has completed its execution due to cancellation. Note that a Cancelled job can be considered Completed too.
Note that if  cancel()  is called in a job in the  New  state, it will not go through the  Cancelling  state. It will directly go to  Cancelled .
主站蜘蛛池模板: 庐江县| 手游| 互助| 南召县| 庄浪县| 南汇区| 威海市| 延津县| 新田县| 蓝田县| 南和县| 高碑店市| 九江市| 衡阳县| 鹿邑县| 尉氏县| 罗平县| 墨玉县| 龙门县| 遂溪县| 崇仁县| 东台市| 九台市| 沙河市| 玉屏| 景宁| 稻城县| 蒙阴县| 黔东| 荣成市| 靖远县| 丹棱县| 奉贤区| 长丰县| 清苑县| 沙坪坝区| 永泰县| 广西| 浦城县| 江川县| 孝义市|