What about reducing the TTL of the dns entry to a significant low value?
With that, the client is "forced" to lookup the IP frequently instead if
lookup the IP once and cache it.
Of course the client can ignore the TTL. But then the client it's the
client's fault if it uses a dead IP.
Maybe have a lok at the dyndns services. They have more or less the same
issue:
one hostname and more or less frequent IP changes... As far as I know,
their solution is DNS TTL of about one minute or so.
Personally I would not try to let the client lookup all IPs and let the
client decide when to switch to another IP, but reduce the TTL and
ensure that the client respects this TTL etc.
- Alex
Am 19.12.2012 15:35, schrieb Suhas Sutar:
After little more testing, I have concluded that it is not MINA issue. To
open a connection to target server, I use below code with MINA:
======================================
ExecutorService ioExecutor = Executors.newCachedThreadPool();
IoConnector ioConnector = new SocketConnector(Runtime.getRuntime()
.availableProcessors()
+ 1, ioExecutor);
SocketAddress socketAddress = new InetSocketAddress(hostAddressString,
hostPortNumber);
ConnectFuture future = ioConnector.connect(socketAddress);
======================================
The InetSocketAddress class internally does a DNS lookup and maintains a
cache of the IP addresses. But it seems that there is no way to retrieve
all the IP addresses associated with a host name. The
method InetSocketAddress.getAddress() returns only one IP address and even
though one of the IPs is unavailable, it would not cycle through the next
one. I even turned off the DNS caching using Java system property
"networkaddress.cache.ttl=0".
Again, it is not caching issue in my opinion. Even though I want to handle
it in the application code, the Java APIs does not provide me a way to know
that there are multiple IP addresses for a given host.
I am not sure how application developers are handling this situation.
On Wed, Dec 19, 2012 at 6:14 AM, Emmanuel Lécharny <elecha...@gmail.com>wrote:
Le 12/19/12 11:15 AM, Jean-Yves Linet a écrit :
Hi,
Well your problem can have multiple explanations :
Do you remove the down host IP from the DNS list ? Otherwise DNS server
will continue to use it.
DNS resolution can be cached somewhere. (see networkaddress.cache in Java
properties)
I doubt that this could be a MINA issue.
I was about to do the exact same answer.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com