Oleg Kalnichevski wrote:
> The I/O reactor works with abstract SocketAddress-es. HttpCore makes no
> assumption whether a particular SocketAddress represents a DNS host name
> or an IP address. The process of DNS name resolution is out of HttpCore
> scope. In practical terms that does mean the I/O thread can be blocked
> while a specific DNS name is being resolved. As this problem cannot be
> solved without an external dependency, I am personally prepared to live
> with this limitation.
This is a bit tricky. It would be good to have an interface that does
the lookup asynchronous. I do something like that in my proxy to spawn a
worker thread that does the lookup. DNS timeouts can easily be 2
minutes, handling many connections with that may be acceptable for
a simple client, but can easily be very bad if you want to build a web
spider or a web proxy or ...
I use the dnsjava package to do dns lookups in rabbit. It is a dns
library in pure java. Internally it uses some parts of nio, but the
interfaces it provides are blocking calls.
I would like to have time to fix dnsjava to provide an asynchronous
interface, but as it is now I do not have the time.