Disable Java JVM Default DNS Caching

You can disable the Java Virtual machine default DNS caching following any of the below methods
( By Default java 1.6 caches all the DNS queries ):

  • Method 1(Changes while staring up JVM)
    • Add -Dsun.net.inetaddr.ttl=0 while starting up the JVM.

  • Method 2(Changes in java config file)
    • Add/Edit the property networkaddress.cache.ttl=0 in %JRE%/lib/security/java.security file. Here JRE refers to Java Runtime Environment folder.

  • Method 3(Changes in your code)
    • Set the property in you java code as java.security.Security.setProperty("networkaddress.cache.ttl", "0" );


Popular posts from this blog

Use environment variable in Jenkins editable email notification subject.

How i tricked IntelliJ IDEA ultimate edition to keep running even after the trial period.

How to locate element in Html 'svg' tag in Selenium 2(Webdriver)