You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 52761fd
Browse filesBrowse the repository at this point in the historyBrowse files
ref(core): Hold the hostname cache on SentryOptions (JAVA-579)
HostnameCache was a process-wide static singleton whose constructor reached
for JavaMonotonicTicker.getInstance() directly. That was the last place in the
SDK hard-coding a ticker rather than taking one from options, so the cache
measured its TTL on System.nanoTime() even where options supply an
elapsedRealtimeNanos()-backed ticker that counts deep sleep.
SentryOptions now holds one instance, built from getMonotonicTicker() the same
way RateLimiter(SentryOptions) is. It is wrapped in a LazyEvaluator because
resolving the hostname blocks on InetAddress.getLocalHost(), which no
Sentry.init should pay for up front; deferring also means the
SentryAndroidOptions override is in effect by the time the ticker is read.
MainEventProcessor still closes the cache, and now drops both its own
reference and the options-held one. Both it and the options outlive
Scopes.close(isRestarting = true), so a closed cache left in either place
would never refresh the hostname again.
MainEventProcessorTest no longer needs Mockito.mockStatic to intercept
getInstance(); it sets the cache on options instead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments