// Controlling DNS caching with System properties
// A value of 0 indicates "never cache".
// A value of -1 indicates "cache forever".
// A plain numeric value means the number of seconds to cache.

// cache lookups for 1000 seconds.
System.properties.setProperty( "networkaddress.cache.ttl", "1000" );

// cache unsuccessful lookups for 10 seconds.
System.properties.setProperty( "networkaddress.cache.negative.ttl", "10" );