Name lookup is still blocking
Wang Weijun
weijun.wang at oracle.com
Mon Jun 23 05:15:42 UTC 2014
I'm using non-blocking SocketChannel (and DatagramChannel) to connect to multiple servers. The argument in SocketChannel.connect(remote) is a SocketAddress, and creating a normal InetSocketAddress object is still blocking. I see there is a InetSocketAddress.createUnresolved() method but calling SocketChannel.connec() upon such an address always throws an UnresolvedAddressException. It seems the sun.nio.ch.Net.checkAddress() method does not try to resolve it at all.
Is there a way to make the name lookup process also non-blocking? Otherwise, if my server list contains a slow-resolving one at 1st position and a faster one at 2nd, there is still no chance for the 2nd one to be picked up.
Thanks
Max
More information about the nio-dev
mailing list