networkaddress.cache

T

thierrykareen

Hi,

does anyone know what the behavior of the network cache is in java
1.4.2 ?

More specifically, I understand that when you do a dns request , the
succesful result is cached forever by default. If I then make a tcp/ip
request to that host , it will use the cached ip adress to establish
the connection. Suppose the server at this ip adress has been shut
down for maintenance and another server with another ip has been set
in the dns. My tcp/ip connection request will fail. What will happen
in the cache ? Will the dns cached result be invalidated and another
request to the dns will go and find the new ip adress for the host or
am I going to have a problem until I restart the jvm ?

Thanks
 
G

Gordon Beaton

does anyone know what the behavior of the network cache is in java
1.4.2?

Moving a server to a different address in the manner you've described
does not (automatically) change the address mapping provided by the
DNS server for the domain.

Also, DNS has a "time to live" attribute that tells other DNS servers
how long they should cache entries for the domain, so even updating
the "real" DNS information cannot be assumed to have the desired
effect until at least that much time has passed. In other words, it
takes time for DNS changes to propagate, with the result that even
newly started applications or applications that do no address caching
at all will see the old address for some time after a change.

A running Java application will cache DNS information forever by
default, but by setting properties networkaddress.cache.ttl and/or
networkaddress.cache.negative.ttl you can get different caching
behaviour. These properties are described in the API documentation for
InetAddress, which should have been the first place you looked.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,052
Latest member
KetoBeez

Latest Threads

Top