summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Terry Wang <tytytyww@google.com> 2021-04-14 13:19:45 -0700
committer Terry Wang <tytytyww@google.com> 2021-04-14 20:39:53 +0000
commitddf9718ead9d27088f2f43c14a75eb567ec1f63c (patch)
tree4b5359c8902dd8d2e64e08d328ec076781087ac4
parent522de6d8df18cc2a9fd773e38c8e4deb29600990 (diff)
Change AppSearchManagerService's thread pool to use LinkedBlockingQueue.
If the service reaches the max pool size which is the number of available processor, we should use LinkedBlockingQueue instead of SynchronousQueue to queue the requests. Bug: 185294190 Test: presubmit Change-Id: I3a9a2f8a149f44fac7ddc01d61a6d1827a8d55bf
-rw-r--r--apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java b/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
index 509877e21862..21e12e7ecc89 100644
--- a/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
+++ b/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
@@ -75,7 +75,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Executor;
-import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
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.
private static final Executor EXECUTOR = new ThreadPoolExecutor(/*corePoolSize=*/1,
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
// "locked" suffix refers to the fact that access to the field should be locked; unrelated to