I need custom Coroutine Dispatch behavior such tha...
# coroutines
a
I need custom Coroutine Dispatch behavior such that it has a bound queue size N, threads=1, and replaces (cancels) oldest enqueued coroutines with newer submissions when the queue is saturated. In java, you can use
ThreadPoolExecutor.DiscardOldestPolicy
and an
ExecutorService
with a bounded queue + single thread. Would it be best to configure the java executor and then
.asCoroutineDispatcher()
on it?