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

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 .
主站蜘蛛池模板: 张家界市| 阿克陶县| 松潘县| 百色市| 田东县| 板桥市| 鄂伦春自治旗| 嘉义县| 深泽县| 刚察县| 贵德县| 丹江口市| 广平县| 沁水县| 介休市| 莱芜市| 南投市| 湘西| 苏尼特右旗| 堆龙德庆县| 昌宁县| 武乡县| 大英县| 惠安县| 江津市| 福安市| 屏东市| 加查县| 左权县| 汪清县| 镇康县| 南投市| 务川| 遂昌县| 防城港市| 邮箱| 慈溪市| 尼玛县| 积石山| 和静县| 巴彦淖尔市|