https://kotlinlang.org logo
Title
p

Paulius Ruminas

03/12/2019, 12:22 PM
Hello, does anyone have an example how to set Dispatchers.IO as okhttp3 Dispatcher?
g

gildor

03/12/2019, 1:17 PM
I think only by implementing own custom CallAdapter that wraps blocking calls to Dispatcher.IO
Not sure that it is good solution tho
p

Paulius Ruminas

03/12/2019, 1:24 PM
Thanks for the answer
g

gildor

03/12/2019, 2:02 PM
What is your use case?
p

Paulius Ruminas

03/12/2019, 3:40 PM
I want to reduce the amount of threads in my app.
g

gildor

03/12/2019, 4:03 PM
Just reduce amount of threads on Dispatcher.IO and OkHttp default dispatcher, both of them are configurable
Using blocking API for this is probably will not help a lot, at least without proper integration on OkHttp dispatcher level
Also OkHttp dispatcher is more flexible