Featured
- Get link
- X
- Other Apps
Inappropriate Blocking Method Call
Inappropriate Blocking Method Call. Inappropriate blocking method call #3255. That is to say (for example):

Here's the test functions, with the prints to see what's going on. Inappropriate blocking method call what is the best way to fix. Try upgrading to the latest stable version.
That Is To Say (For Example):
Coroutine should never call blocking function. I can use the coroutines of kotlin with retrofit. If you are performing a blocking network request (using retrofit):
Copy Link Author Cj848 Commented Mar 29, 2020.
I am studying kotlin now. Try upgrading to the latest stable version. {{ (>_<) }}this version of your browser is not supported.
Wrap The Inappropriate Blocking Method Call Code In Another Context Using Withcontext.
Since you obviously need to call these methods, use a dispatcher that tries to create a new thread for every coroutine, like dispatchers.io (which is designed for those operations, see the When using blocking methods, they block the whole thread and will probably prevent other coroutines from running. The subtleties of the dispatchers.io is missed by the compiler warnings.
If You Are Doing A Read/Write Blocking Method Call:
This did not happen all the time though. The usual places you'll deliberately block in a migration such as this is either in a separate threadpool (one you've designated for these blocking tasks specifically), or the built in reactor schedulers.elastic or schedulers.boundedelastic pools, which are. Regardless of how you are calling this function you should always ensure blocking code is launched in io dispatchers.
If I Remove The Annotation, The Warning Goes Away.
I'm calling readvalue(string, class) from a kotlin suspend fun coroutine. Try upgrading to the latest stable version. I run “blocking method”, which compiler assumes by @throws(ioexception::class) annotation.
Comments
Post a Comment