Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DNS oddity

Posted on 2006-06-28
1
Medium Priority
?
220 Views
Last Modified: 2010-03-31
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/65.54.239.140: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/65.54.239.210:1863'.

The obvious difference between the two being that the address of 'messenger.hotmail.com' had changed to 65.54.239.210 from 65.54.239.140.  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?
0
Comment
Question by:derekl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 1000 total points
ID: 17004447
yes, you are right. By default, JVM caches successful name lookups forever. However, you can change this by setting the following system property:

networkaddress.cache.ttl

The value -1 (by default) indicates that the lookup would be cached forerver. If this is set is 5, it would cache the successful lookup for 5 secs
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question