A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://plugins.jetbrains.com/docs/intellij/kotlin-coroutines.html below:

Kotlin Coroutines | IntelliJ Platform Plugin SDK

Kotlin Coroutines

The IntelliJ Platform is a multithreading environment that executes many asynchronous and non-blocking tasks to avoid UI freezes. These tasks are usually executed in background threads, which is a standard approach in the JVM world.

Since version 1.1, Kotlin has introduced coroutines as a lightweight and cleaner abstraction over threads, allowing them to be utilized more efficiently. The IntelliJ Platform started adapting coroutines in its APIs and internal code, and since 2024.1 it is recommended to use the coroutines approach over threads.

Plugins must use the bundled Kotlin Coroutines library, see Kotlin Coroutines Libraries (kotlinx.coroutines) .

Coroutines Advantages

The reason for coroutines being lightweight is the fact that they aren't bound to OS native threads, as opposed to the JVM threads. It enables much less memory consumption and more efficient context switching, which makes the platform and plugins more performant. For example, it is straightforward to run 100.000 coroutines on a standard computer, which is not possible with threads as it would cause OutOfMemoryError.

Besides performance, there are more advantages of using coroutines:

Java Interoperability

Coroutines provide very limited Java interoperability, and coroutine-based APIs can’t be used to the full extent from Java code.

Kotlin Coroutines are relatively new to the IntelliJ Platform and aren't yet widely adopted in public APIs. In the future, the number of coroutine-based APIs will grow, and using only Java may not be enough to implement a fully functional plugin. It will be required to use Kotlin, at least partially, for example, to implement coroutine-based extension points.

Learning Resources

Before going to the next coroutine-related sections, it is highly recommended to go through the following resources. It will help understand coroutines and become fluent with available APIs:

If a topic is not covered in the above sections, let us know via the Was this page helpful? feedback form below or other channels.

Be specific about the topics and reasons for adding them and leave your email in case we need more details. Thanks for your feedback!

19 March 2025


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4