使用ThreadPoolExecutor和AsyncTask

3

使用ThreadPoolExecutor时,我能否将AsyncTask用作我的队列中的Runnable?还是这样做会失去意义?

//A holder for various tasks
private final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(5);

//Thread Pool Executor
private final ThreadPoolExecutor tpe = new ThreadPoolExecutor(3, 3, 10, TimeUnit.SECONDS, queue);
2个回答

6

AsyncTask不是Runnable,所以你不能真正使用它。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接