Coroutines 디버깅

    IntelliJ IDEA 사용해 Kotlin Flow 디버깅 하기

    IntelliJ IDEA 사용해 Kotlin Flow 디버깅 하기

    이 튜토리얼은 IntelliJ IDEA를 사용해 Kotlin Flow를 생성하고 디버깅 하는 방법에 대해 설명한다. 이 튜토리얼에서는 독자들이 Coroutine 개념에 대한 사전 지식이 있다고 가정한다. Kotlin Flow 생성하기 느린 방출기와 느린 수집기를 가진 Kotlin flow를 생성한다: 1. Intellij IDEA에서 Kotlin 프로젝트를 연다. 만약 프로젝트가 없다면 하나를 새로 만든다. 2. kotlinx.coroutines 라이브러리를 Gradle 프로젝트에서 사용하기 위해서 다음 종속성을 build.gradle(.kts)에 추가한다. Kotlin Gradle dependencies { implementation("org.jetbrains.kotlinx:kotlinx-corouti..

    Coroutine Context와 Dispatcher 4편 - 부모 Coroutine의 책임, Coroutines에 이름 짓기, Context 요소들 결합하기

    부모 Coroutine의 책임 부모 Coroutine은 언제나 자식들이 완료될 때까지 기다린다. 부모는 모든 자식들의 실행을 명시적으로 추적하지 못하고, 그들이 모두 끝날 때까지 기다리기 위해 Job.join을 사용할 필요가 없다. // launch a coroutine to process some kind of incoming request val request = launch { repeat(3) { i -> // launch a few children jobs launch { delay((i + 1) * 200L) // variable delay 200ms, 400ms, 600ms println("Coroutine $i is done") } } println("request: I'm done and..

    Coroutine Context와 Dispatcher 2편 - Coroutines와 Threads 디버깅 하기 : IntelliJ 사용, 로깅 사용

    Coroutine Context와 Dispatcher 2편 - Coroutines와 Threads 디버깅 하기 : IntelliJ 사용, 로깅 사용

    Coroutines와 Threads 디버깅 하기 Coroutines는 하나의 스레드에서 일시 중단한 다음 다른 스레드에서 재개될 수 있다. 싱글 스레드를 가진 Dispatcher에서도 특별한 도구가 없으면 Coroutine이 언제, 어디서 무엇을 하는지 알기 어렵다.*1 IDEA를 사용해 디버깅 하기 Kotlin Plugin인 Coroutine Debugger은 Intellij IDEA에서 Coroutines 디버깅을 간단하게 할 수 있도록 한다. 📍 디버깅은 kotlinx-coroutines-core 1.3.8 혹은 그 이후 버전에서부터만 동작한다. Debug tool window는 Coroutines 탭을 포함한다. 이 탭에서 현재 실행 중이거나 일시 중단된 Coroutine 모두에 대한 정보를 확인..