Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.security.Security.setProperty doesn't work  RSS feed

 
Tim Lincecum
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to change the DNS cache time for JVM.
There are 3 ways to do this.

1. modify networkaddress.cache.ttl in config file: $JAVA_HOME/jre/lib/security/java.security

2. add -Dsun.net.inetaddr.ttl=value in JVM startup script

3. Use java.security.Security.setProperty(“propertyname”, “value”) to programmatically set the property.

only method 3 can control the value dynamically but I have tried
under JDK 1.6, doesn't work.

I already turn off my OS dns cache.

Anyone has experienced the same problem?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!