On 08/11/18 08:22, Alan Bateman wrote:
...
Right, the caching, if any, has to be per instance in order to work with different SocketImpl implementations. The change drops the synchronization and so brings up the question as to whether this method is thread safe or not. One simple approach (and there are several) is to get rid of the optionsSet flag and change options to be volatile. You could use Set.copyOf too.

The cache field has been made volatile and set iff null.

I refrained from using copyOf as I didn't want to change the
type of the returned set.

http://cr.openjdk.java.net/~chegar/8213418/webrev.01/

-Chris.

Reply via email to