Possibly blocking call in non-blocking context
Reports thread-blocking method calls in code fragments where threads should not be blocked.
Example (Project Reactor):
Consider running blocking code with a proper scheduler, for example Schedulers.boundedElastic()
, or try to find an alternative non-blocking API.
Example (Kotlin Coroutines):
Consider running blocking code with a special dispatcher, for example Dispatchers.IO
, or try to find an alternative non-blocking API.
Configure the inspection:
In the Blocking Annotations list, specify annotations that mark thread-blocking methods.
In the Non-Blocking Annotations list, specify annotations that mark non-blocking methods.
Specified annotations can be used as External Annotations
Inspection options
Option | Type | Default |
---|---|---|
Consider unknown contexts blocking | Checkbox | true |
Consider Kotlin suspend context non-blocking | Checkbox | true |
Blocking annotations | StringList | [org.jetbrains.annotations.Blocking, io.micronaut.core.annotation.Blocking, io.smallrye.common.annotation.Blocking] |
Non-blocking annotations | StringList | [org.jetbrains.annotations.NonBlocking, io.micronaut.core.annotation.NonBlocking, io.smallrye.common.annotation.NonBlocking] |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |