Technoboy- commented on code in PR #18565:
URL: https://github.com/apache/pulsar/pull/18565#discussion_r1028968991


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/DnsResolverUtil.java:
##########
@@ -44,13 +44,16 @@ public class DnsResolverUtil {
             Class<?> inetAddressCachePolicyClass = 
Class.forName("sun.net.InetAddressCachePolicy");
             Method getTTLMethod = inetAddressCachePolicyClass.getMethod("get");
             ttl = (Integer) getTTLMethod.invoke(null);
+            if (ttl <= 0) {
+                ttl = DEFAULT_TTL;
+            }
             Method getNegativeTTLMethod = 
inetAddressCachePolicyClass.getMethod("getNegative");
             negativeTtl = (Integer) getNegativeTTLMethod.invoke(null);
         } catch (NoSuchMethodException | ClassNotFoundException | 
InvocationTargetException
                  | IllegalAccessException e) {
             log.warn("Cannot get DNS TTL settings from 
sun.net.InetAddressCachePolicy class", e);
         }
-        TTL = useDefaultTTLWhenSetToForever(ttl, DEFAULT_TTL);
+        TTL = ttl;
         NEGATIVE_TTL = useDefaultTTLWhenSetToForever(negativeTtl, 
DEFAULT_NEGATIVE_TTL);

Review Comment:
   fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to