RFR: 8313239: InetAddress.getCanonicalHostName may return ip address if reverse lookup fails [v3]

Jaikiran Pai jpai at openjdk.org
Fri Aug 4 08:06:38 UTC 2023


On Thu, 3 Aug 2023 18:20:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> I was thinking more about the caching and attempting the lookup only on first usage.

If we do have to make a mention of that, then I think we would have to probably change the implementation to actually do the lookup only on first usage. Right now, the `canonicalHostName` field isn't `volatile` and there isn't any construct in place which will ensure that multiple concurrent calls to this method will ensure only one lookup happens. It's harmless in the current form, but if we add an `implNote` about this, then I think we would have to make it actually behave that way.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15134#discussion_r1284116547


More information about the net-dev mailing list