CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • CoroutineScope and Job — task hierarchy and lifecycle management

    Kotlin SELF
    Level 53, Lesson 0
    We break down structured concurrency in Kotlin coroutines: why coroutines need an “owner” in the form of CoroutineScope, how runBlocking and coroutineScope create operation boundaries and automatically wait for child tasks, what exactly launch returns (it is a Job), and how to explicitly control wait points via join(). We reinforce the “parent → children” hierarchy idea and assemble a small report from parallel steps in the Expense Tracker example.
    Available
  • withContext and dispatcher in a coroutine: switching the execution location

    Kotlin SELF
    Level 53, Lesson 1
    We break down how, inside a single coroutine, to locally switch the execution context using withContext: what CoroutineContext and CoroutineDispatcher are, how Dispatchers. Default (CPU) and Dispatchers. IO (I/O) differ, why withContext is suspend, and why it does not provide parallelism. Using a mini-app (“cash register”) and thread logging, we show switching, practical patterns, and typical mistakes.
    Available
  • Coroutine cancellation: cancel/join, cooperativeness, and isActive

    Kotlin SELF
    Level 53, Lesson 2
    Let’s break down how cancellation works in kotlinx.coroutines: how cancel(), join(), and cancelAndJoin() differ, why coroutine cancellation is cooperative, where the “stopping points” are (for example, delay()), and how to write your own loops so they respect cancellation via isActive. At the end, there is a practical scenario with a “long report” and a breakdown of common mistakes.
    Available
  • Exceptions in coroutines: launch/async differences

    Kotlin SELF
    Level 53, Lesson 3
    We’ll break down how exceptions behave in Kotlin coroutines and why error handling differs for launch and async: where try/ catch actually triggers, why an exception from async usually shows up at await(), how errors “bubble up” at the coroutineScope/ runBlocking boundary, and which common pitfalls (forgotten await(), the wrong builder choice, “swallowing” errors) most often break scenarios.
    Available
  • Cleanup on cancellation and errors — try/finally as a completion guarantee

    Kotlin SELF
    Level 53, Lesson 4
    We break down why, in coroutines, cleanup is part of the contract: a coroutine can finish early due to cancel(), an exception, or an early return. We learn to guarantee “cleanup” via try/ finally, wait for completion correctly via cancelAndJoin(), distribute responsibility across levels (parent/children), and avoid turning finally into a source of new errors.
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym