Alan Bateman wrote:

Alan,

The specification could be improved but changing InetAddress.getByName to return a random address is a significant change that could break existing applications. It might be better to define a new method, perhaps "getAnyByName", that randomly chooses one of the cached addresses for the host (or does a lookup if not in the cache). That would be a convenience to applications to avoid needing to invoke getAllByName and choose an address themselves.

I don't think it's a significant change, since that's how getByName() acts when the cache entries time out, so changing it would make it act a lot more consistently.

Actually, I think it's worth debating whether or not InetAddress should cache lookups at all, I think it's more fitting to delegate that to the underlying OS.

--
Andreas

Reply via email to