I was expecting that multiple JobIntentServices would use always one thread for each.
I have several JobIntentServices
class Client1 : JobIntentService() {
...
}
,
class Client2 : JobIntentService() {
...
}
,
class Client3 : JobIntentService() {
...
}
,
class Client4 : JobIntentService() {
...
}
and so on. And one Intent for each ex:
val client1Intent = Intent(this, Client1::class.java)
client1Intent.putExtra("some_name", info)
client1Intent.putExtra("other_name", otherInfo) Client1.enqueueWork(this, client1Intent)
When I check the thread on override fun onHandleWork(intent: Intent)
override fun onHandleWork(intent: Intent) {
...
Log.d(TAG, "Current THREAD: ${Thread.currentThread()}")
}
I see in logcat that the services were separated in just two threads:
Thread[AsyncTask #2,5,main] and Thread[AsyncTask #1,5,main]
Therefore they are running just two each time. I expected that the number of asynctasks would be equals to the number of JobIntentServices. Why it is not so?