Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9be47ce authored by Romain Guy's avatar Romain Guy
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.
parent 6067d953
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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);