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

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 .
主站蜘蛛池模板: 赤峰市| 辉县市| 乌兰浩特市| 聂荣县| 历史| 青海省| 靖州| 陕西省| 开封市| 香河县| 武胜县| 泽州县| 丹凤县| 宁明县| 定襄县| 大渡口区| 清水河县| 玛沁县| 宣城市| 增城市| 襄汾县| 宁安市| 扶沟县| 威远县| 鄂温| 武平县| 井冈山市| 信宜市| 西充县| 宾阳县| 綦江县| 翁源县| 太仓市| 朔州市| 朔州市| 基隆市| 乌什县| 安龙县| 虞城县| 光泽县| 刚察县|