private static long getNetworkAddressCacheTtlNanos(boolean isAndroid) {
    if (isAndroid) {
      // on Android, ignore dns cache.
      return 0;
    }

    String cacheTtlPropertyValue = System.getProperty(NETWORKADDRESS_CACHE_TTL_PROPERTY);
    long cacheTtl = DEFAULT_NETWORK_CACHE_TTL_SECONDS;
    if (cacheTtlPropertyValue != null) {
      try {
        cacheTtl = Long.parseLong(cacheTtlPropertyValue);
      } catch (NumberFormatException e) {
        logger.log(
            Level.WARNING,
            "Property({0}) valid is not valid number format({1}), fall back to default({2})",
            new Object[] {NETWORKADDRESS_CACHE_TTL_PROPERTY, cacheTtlPropertyValue, cacheTtl});
      }
    }
    return cacheTtl > 0 ? TimeUnit.SECONDS.toNanos(cacheTtl) : cacheTtl;
  }
private static long getNetworkAddressCacheTtlNanos ( boolean isAndroid ) { if ( isAndroid ) { return 0 ; } String cacheTtlPropertyValue = System . getProperty ( NETWORKADDRESS_CACHE_TTL_PROPERTY ) ; long cacheTtl = DEFAULT_NETWORK_CACHE_TTL_SECONDS ; if ( cacheTtlPropertyValue != null ) { try { cacheTtl = Long . parseLong ( cacheTtlPropertyValue ) ; } catch ( NumberFormatException e ) { logger . log ( Level . WARNING , "Property({0}) valid is not valid number format({1}), fall back to default({2})" , new Object [ ] { NETWORKADDRESS_CACHE_TTL_PROPERTY , cacheTtlPropertyValue , cacheTtl } ) ; } } return cacheTtl > 0 ? TimeUnit . SECONDS . toNanos ( cacheTtl ) : cacheTtl ; }
Returns value of network address cache ttl property if not Android environment. For android,
DnsNameResolver does not cache the dns lookup result.