Tweak the core and maximum pool sizes for AsyncTask.

This change allows up to 5 AsyncTasks to run concurrently. Before, only 1 task
could run at a time, which was too limited. This change also bumps up the maximum
number of tasks that can be created; this large number is not an issue because
tasks are queued up and run only 5 at a time.
This commit is contained in:
Romain Guy
2009-06-26 10:34:20 -07:00
parent 6067d953d7
commit a9be47cea4

View File

@@ -127,12 +127,12 @@ import java.util.concurrent.atomic.AtomicInteger;
public abstract class AsyncTask<Params, Progress, Result> {
private static final String LOG_TAG = "AsyncTask";
private static final int CORE_POOL_SIZE = 1;
private static final int MAXIMUM_POOL_SIZE = 10;
private static final int CORE_POOL_SIZE = 5;
private static final int MAXIMUM_POOL_SIZE = 128;
private static final int KEEP_ALIVE = 10;
private static final BlockingQueue<Runnable> sWorkQueue =
new LinkedBlockingQueue<Runnable>(MAXIMUM_POOL_SIZE);
new LinkedBlockingQueue<Runnable>(10);
private static final ThreadFactory sThreadFactory = new ThreadFactory() {
private final AtomicInteger mCount = new AtomicInteger(1);