I'm attempting to change the DNS cache timeout in Java 1.6. I see discussion here of using something like the following:
java.security.Security.setProperty ("networkaddress.cache.ttl" , TTL_SECS);
But I've tried this simple test in Win 7....
System.out.println("DEFAULT DNS TTL: "+sun.net.InetAddressCachePolicy.get());
java.security.Security.setProperty ("networkaddress.cache.ttl" , "123");
System.out.println("DEFAULT DNS TTL: "+sun.net.InetAddressCachePolicy.get());
... and the output doesn't change. It seems this can be changed in the Java installation's security properties but I preffer to keep this in the code for neatness. Any ideas how to achieve that?
Thanks.