Hi All,

I noticed that InetAddress.getLocalHost() uses cache to improve the performance. However the default implementation is caching local host within 5 seconds.

From the spec, networkaddress.cache.ttl should be used to control the cache behaviour and I think it is a better solution.

For example, if the networkaddress.cache.ttl is set to -1 which means always cache the local host then we can avoid unnecessary operations on getAddressesFromNameService to improve the performance.

I have made a patch for this solution, so anyone would like to take a look?

[1] http://cr.openjdk.java.net/~littlee/OJDK-527/webrev.00/ <http://cr.openjdk.java.net/%7Elittlee/OJDK-527/webrev.00/>
Thanks a lot!

--
Best Regards,

Deven

Reply via email to