July 2018
Intermediate to advanced
266 pages
7h 11m
English
The next step is to update the dispatcher. Let's make it a thread pool of size 2 and rename it to IO:
val dispatcher = newFixedThreadPoolContext(2, "IO")
Here, we are increasing the size of the pool because asyncFetchHeadlines() is not only fetching the information from the server but also parsing it. This overhead of parsing the XML will affect performance if we use a single thread; sometimes fetching information from one feed can be delayed until the parsing of another is completed.
Read now
Unlock full access