- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 181字
- 2021-08-05 10:46:51
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 .
推薦閱讀
- The Complete Rust Programming Reference Guide
- GAE編程指南
- Interactive Data Visualization with Python
- Spring Cloud、Nginx高并發核心編程
- 零基礎輕松學SQL Server 2016
- Node.js全程實例
- Visual Basic程序設計教程
- Machine Learning in Java
- 深度實踐KVM:核心技術、管理運維、性能優化與項目實施
- 官方 Scratch 3.0 編程趣味卡:讓孩子們愛上編程(全彩)
- Software Development on the SAP HANA Platform
- 超好玩的Scratch 3.5少兒編程
- Oracle SOA Suite 12c Administrator's Guide
- H5頁面設計與制作(全彩慕課版·第2版)
- Splunk Developer's Guide(Second Edition)