Merge "Change AppSearchManagerService's thread pool to use LinkedBlockingQueue." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-04-15 19:22:30 +00:00
committed by Android (Google) Code Review

View File

@@ -75,7 +75,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@@ -94,7 +94,7 @@ public class AppSearchManagerService extends SystemService {
// mutate requests will need to gain write lock and query requests need to gain read lock. // mutate requests will need to gain write lock and query requests need to gain read lock.
private static final Executor EXECUTOR = new ThreadPoolExecutor(/*corePoolSize=*/1, private static final Executor EXECUTOR = new ThreadPoolExecutor(/*corePoolSize=*/1,
Runtime.getRuntime().availableProcessors(), /*keepAliveTime*/ 60L, TimeUnit.SECONDS, Runtime.getRuntime().availableProcessors(), /*keepAliveTime*/ 60L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>()); new LinkedBlockingQueue<>());
// Cache of unlocked user ids so we don't have to query UserManager service each time. The // Cache of unlocked user ids so we don't have to query UserManager service each time. The
// "locked" suffix refers to the fact that access to the field should be locked; unrelated to // "locked" suffix refers to the fact that access to the field should be locked; unrelated to