Posted on 2006-06-28
Given the following code:
InetSocketAddress isaCurrent = new InetSocketAddress("messenger.hotmail.com", 1863);
sm_logger.info("Connecting to server '" + isaCurrent + "'.");
at the tail end of a process that had been running for upwards of a week this code resulted in the following log4j output:
2006-06-21 23:34:50,797 INFO - Connecting to server 'messenger.hotmail.com/220.127.116.11:1863'.
30 seconds later after the process had been stopped and re-started the following lof4j ouput resulted:
2006-06-21 23:35:28,250 INFO - Connecting to server 'messenger.hotmail.com/18.104.22.168:1863'.
The obvious difference between the two being that the address of 'messenger.hotmail.com' had changed to 22.214.171.124 from 126.96.36.199. Assuming that the DNS entry had indeed been changed prior to the first log statement, I'm wondering why it took restarting the process for the address change to be recognized in my Java code?
Is it possible that the JVM caches DNS resolves and uses cached values for as long as the process runs going forward?