Name lookup is still blocking
Chris Hegarty
chris.hegarty at oracle.com
Mon Jun 23 07:57:26 UTC 2014
On 23/06/14 06:15, Wang Weijun wrote:
> 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?
Not that I am aware of.
-Chris
> 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