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.
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
BlockingMethodInNonBlockingContext- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
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
Here you can find the description of settings available for the Possibly blocking call in non-blocking context inspection, and the reference of their default values.
- Consider unknown contexts blocking
Default value:
Selected- Consider Kotlin suspend context non-blocking
Default value:
Selected- Blocking annotations
Default value:
[org.jetbrains.annotations.Blocking, io.micronaut.core.annotation.Blocking, io.smallrye.common.annotation.Blocking]- Non-blocking annotations
Default value:
[org.jetbrains.annotations.NonBlocking, io.micronaut.core.annotation.NonBlocking, io.smallrye.common.annotation.NonBlocking]
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |