commit | 4c5115d2196a6912102616c77aa233f14cb8b382 | [log] [tgz] |
---|---|---|
author | Jiakai Zhang <jiakaiz@google.com> | Tue Jan 09 19:22:26 2024 +0000 |
committer | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | Wed Jan 10 20:52:25 2024 +0000 |
tree | ee9c34a862ef0937daa17b8ea6920ce6f669e891 | |
parent | 40855538527351c24a272252efa52a2e4ff2d27b [diff] |
Throttle the creation of threads in Debouncer (again). http://r.android.com/2887708 throttled the creation of ScheduledExecutorService, but it didn't actually throttle the creation of threads because we were using the ScheduledExecutorService created by Executors.newSingleThreadScheduledExecutor(), which has a surprising behavior that it destroys the single thread when the last task is cancelled, and re-creates it when a new task is scheduled. After this change, we use the ScheduledExecutorService created by Executors.newScheduledThreadPool(1 /* corePoolSize */) instead. Bug: 317234694 Test: - 1. Capture a trace starting from right before `adb shell start` with `--duration 120` and `-e sched:sched_wakeup_new`. 2. See only one thread creation initiated by "notifyDexLoad" (https://pprofng.corp.google.com/?id=721c44e87ff38dff14d4a6e7d6e1c010&pivot=%5Ecom%5C.android%5C.server%5C.pm%5C.PackageManagerService%5C$IPackageManagerImpl%5C.notifyDexLoad$) Change-Id: I21bd9040c1cf2508b3912236a25522f9bfb8e39f