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

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 .
主站蜘蛛池模板: 贵定县| 万年县| 龙游县| 天等县| 巧家县| 龙泉市| 黎平县| 苍溪县| 洪洞县| 靖西县| 交口县| 阿巴嘎旗| 贵南县| 正镶白旗| 龙游县| 广水市| 中山市| 确山县| 罗田县| 施甸县| 平江县| 郧西县| 建德市| 岳阳市| 南汇区| 天祝| 水富县| 西乌珠穆沁旗| 普格县| 思茅市| 巫溪县| 贵德县| 陆河县| 凤阳县| 哈巴河县| 甘德县| 金山区| 靖边县| 南宁市| 金华市| 策勒县|