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

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 .
主站蜘蛛池模板: 沙雅县| 黄山市| 遂川县| 濮阳市| 磴口县| 景泰县| 泉州市| 汽车| 全南县| 长顺县| 清水河县| 闵行区| 简阳市| 元朗区| 塘沽区| 苏州市| 德钦县| 吴堡县| 宝坻区| 甘谷县| 福清市| 南丰县| 潢川县| 固始县| 隆回县| 公安县| 右玉县| 屯门区| 莎车县| 碌曲县| 镇远县| 寿宁县| 伊宁县| 当涂县| 海晏县| 麦盖提县| 惠州市| 秀山| 濮阳县| 巫溪县| 沧源|