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

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 .
主站蜘蛛池模板: 西乌| 天长市| 隆昌县| 昌黎县| 沙湾县| 屏山县| 永安市| 峨边| 太白县| 南康市| 湄潭县| 咸宁市| 黄陵县| 兰考县| 琼海市| 武义县| 桂阳县| 平乡县| 芜湖市| 大方县| 临夏县| 乌海市| 增城市| 聂拉木县| 临海市| 长泰县| 德庆县| 灌阳县| 韶山市| 扎兰屯市| 政和县| 霞浦县| 扎赉特旗| 宽城| 屯昌县| 广德县| 平罗县| 贵阳市| 汉寿县| 黎川县| 清苑县|