Caching behaviour of InetAddress
Andreas Plesner Jacobsen
apj.lists at code3.dk
Mon Feb 18 03:43:03 PST 2008
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
More information about the net-dev
mailing list