Change the default of how AsyncTask enqueues.
The default is now to serialize everything onto the thread pool. If you would like to have finer grained control over how AsyncTasks are executed, you can call the new executeOnExecutor method, which takes a custom Executor. The pool used by the default is handily now accessible as THREAD_POOL_EXECUTOR. This change is because it is too tempting to convert single threaded Janky™ code to use AsyncTask in a way that is unsafe and ends up calling the AsyncTasks in parallel. Also, this adds a static execute(Runnable) method to AsyncTask that posts onto the serialized queue, so that if you don't have any parameters or return values, you can just use Runnable instead of AsyncTask. Change-Id: I91bdfb00193542bfc2e101bcad56e3430421884a
Loading
Please register or sign in to comment