Hi, i want to send many web requests concurrently ...
# announcements
c
Hi, i want to send many web requests concurrently since sequentially they take like 5 minutes. Then combine the results and return them. What would be a good way of dealing with this?I read some things about coroutines, but havent got them working yet.
r
Or you could go old school and have an `ExecutorService`:
Copy code
import java.util.concurrent.Executors

val executor = Executors.newCachedThreadPool()
val future1 = executor.submit { /* make the request here */ }
val future2 = executor.submit { /* make the request here */ }
val res1 = future1.get()
val res2 = future2.get()
c
Ive found out why it didnt work. A classic missing dependency 😄 Thought it was included in base kotlin package.