Permalink
Browse files

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.
  • Loading branch information...
Romain Guy
Romain Guy committed Jun 26, 2009
1 parent 6067d95 commit a9be47cea45c19f2869732252e9922bf88fa4d86
Showing with 3 additions and 3 deletions.
  1. +3 −3 core/java/android/os/AsyncTask.java
@@ -127,12 +127,12 @@
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);

0 comments on commit a9be47c

Please sign in to comment.