perf(android): [SDK Overhead Reduction 3] Reuse SentryExecutorService for DeviceInfoUtil pre-caching by adinauer · Pull Request #5502 · getsentry/sentry-java
PR Stack (SDK Overhead Reduction)
- perf(core): [SDK Overhead Reduction 1] Skip java.specification.version lookup on Android #5500
- perf(android): [SDK Overhead Reduction 2] Replace reflective OptionsContainer with direct subclass #5501
- perf(android): [SDK Overhead Reduction 3] Reuse SentryExecutorService for DeviceInfoUtil pre-caching #5502
📜 Description
Replace Executors.newSingleThreadExecutor() with options.getExecutorService() in DefaultAndroidEventProcessor for the DeviceInfoUtil pre-caching task. This avoids creating a dedicated thread + executor during SDK init when the SDK already has an executor service available. Also removes the executorService.shutdown() call since we don't own the shared executor.
💡 Motivation and Context
Part of the SDK Overhead Reduction stack. During Android SDK init, DefaultAndroidEventProcessor was creating its own SingleThreadExecutor just to submit one task for pre-caching device info. The SDK's executor service (SentryExecutorService) is already available at this point and can handle this work without the overhead of spinning up an additional thread pool.
💚 How did you test it?
./gradlew :sentry-android-core:compileDebugUnitTestJavaWithJavac— compiles successfully./gradlew spotlessApply apiDump— no API surface changes
📝 Checklist
- I added GH Issue ID & Linear ID
- I added tests to verify the changes.
- No new PII added or SDK only sends newly added PII if
sendDefaultPIIis enabled. - I updated the docs if needed.
- I updated the wizard if needed.
- Review from the native team if needed.
- No breaking change or entry added to the changelog.
- No breaking change for hybrid SDKs or communicated to hybrid SDKs.
🔮 Next steps
More SDK overhead reduction PRs in this stack.
⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.
#skip-changelog