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
>
>

Reply via email to