简体   繁体   English

在Android中使用固定数量的线程创建多个队列

[英]creating multiple queues with a fixed number of threads in android

I want to create multiple event queues in Android each queue associated with a fixed number of threads. 我想在Android中创建多个事件队列,每个队列与固定数量的线程相关联。

each queue has a specific purpose and will hold the related tasks. 每个队列都有特定的用途,并将承担相关任务。 eg one queue will hold all the tasks related to do the network operation, other queue requires to hold the tasks related to the disk io. 例如,一个队列将保存与执行网络操作相关的所有任务,另一队列将保留与磁盘io相关的任务。 My application will have a large number of these kinds tasks. 我的应用程序将包含大量此类任务。

how can I accomplish this ? 我怎样才能做到这一点?

As per my current understanding ThreadPoolExecutor can help. 根据我目前的理解, ThreadPoolExecutor可以提供帮助。 is my understanding correct ? 我的理解正确吗? if yes how can I use it. 如果是,我该如何使用它。

Perhaps you should read the article I wrote on this subject. 也许您应该阅读我写的关于该主题的文章。 Managing Threads in Android Not to push my own article, it describes an open-source project (new release coming out Friday) that does just what you want. 在Android中管理线程不用写我自己的文章,它描述了一个开源项目(周五发布的新版本),它可以完成您想要的任何事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM