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

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 .
主站蜘蛛池模板: 资中县| 祥云县| 兴文县| 融水| 遂宁市| 库伦旗| 望江县| 白玉县| 永丰县| 景东| 汉源县| 邳州市| 文水县| 和静县| 玛纳斯县| 集安市| 台北市| 齐河县| 固始县| 大兴区| 饶阳县| 稻城县| 新宾| 高陵县| 喀喇| 炎陵县| 东丽区| 徐闻县| 罗平县| 太康县| 靖安县| 秭归县| 会理县| 西平县| 斗六市| 洪湖市| 友谊县| 东城区| 浙江省| 保定市| 昭苏县|