Consider the following piece of code:
suspend fun childTaskExecutor() {
GlobalScope.future(Dispatchers.Default) {
val currentThread = Thread.currentThread()
logger.info("[childTaskExecutor] running on ${currentThread.name} group : ${currentThread.threadGroup}")
}.awaitOrNull()
}
When I run this the output is:
[childTaskExecutor] running on DefaultDispatcher-worker-9 group : java.lang.ThreadGroup[name=main,maxpri=10]
When I change the context to Dispatchers.IO the output is:
running on DefaultDispatcher-worker-6 group : java.lang.ThreadGroup[name=main,maxpri=10]
I want to be able to figure out which thread pool does the thread belong to (IO, Default, Unconfined). Any way to do that?