Inspectopedia
 
2024.3

Possibly blocking call in non-blocking context

Warning
Performance
New
Last modified: 03 December 2024

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