Package io.sentry
Class HostnameCache
java.lang.Object
io.sentry.HostnameCache
Time sensitive cache in charge of keeping track of the hostname. The
InetAddress.getLocalHost().getCanonicalHostName()
call can be quite expensive and could be
called for the creation of each SentryEvent
. This system will prevent unnecessary costs
by keeping track of the hostname for a period defined during the construction. For performance
purposes, the operation of retrieving the hostname will automatically fail after a period of time
defined by GET_HOSTNAME_TIMEOUT
without result.
HostnameCache is a singleton and its instance should be obtained through getInstance()
.
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
Gets the hostname of the current machine.static @NotNull HostnameCache
-
Method Details
-
getInstance
-
getHostname
Gets the hostname of the current machine.Gets the value from the cache if possible otherwise calls
updateCache()
.- Returns:
- the hostname of the current machine.
-