RFR [12] 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl

Chris Hegarty chris.hegarty at oracle.com
Thu Nov 8 11:53:33 UTC 2018

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.



More information about the net-dev mailing list