单独的 IntentService 实例是否共享同一个队列?

Do separate IntentService instances share the same queue?

我有一个关于 IntentService 的问题

假设我有两个意图服务 类,它们执行彼此无关的任务。

public class TaskA extends IntentService{
    @Override
    protected void onHandleIntent(Intent workIntent) {}        
}

第二个

public class TaskB extends IntentService{
    @Override
    protected void onHandleIntent(Intent workIntent) {}            
}

如果我先启动 TaskA,然后下一行启动 TaskB,TaskB 是否必须等待 TaskA 完成?

我知道如果我再次启动相同的意图服务,它会被添加到队列中,但这适用于一个实例还是对整个应用程序是全局的?

来自the documentation

All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main loop), but only one request will be processed at a time.

If I start TaskA first and then next line start TaskB, would TaskB have to wait for TaskA to finish?

每个 IntentService 都有自己的工作线程。具体来说,它是 HandlerThread 的一个实例,如 the source code to IntentService 中所见。因此,一个 IntentServiceonHandleIntent() 不应阻止另一个 IntentServiceonHandleIntent()