<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you Lucy,<div class=""><br class=""></div><div class="">We’ll proceed with removing the setting of SO_REUSEPORT from the</div><div class="">MulticastSocket constructor and spec.</div><div class=""><br class=""></div><div class="">-Chris.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 28 Sep 2016, at 20:02, Lu, Yingqi <<a href="mailto:yingqi.lu@intel.com" class="">yingqi.lu@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hi Vyom,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thank you very much checking with us.<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">We agree that SO_RESUEADDR and SO_REUSEPORT behave the same way for MulticastSocket. There is no need to check and enable SO_REUSEPORT for this particular type of socket. SO_REUSEADDR is sufficient.<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thanks,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Lucy<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div class=""><div style="border-style: solid none none; border-top-color: rgb(225, 225, 225); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><a name="_____replyseparator" class=""></a><b class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: windowtext;" class="">From:</span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: windowtext;" class=""><span class="Apple-converted-space"> </span>Vyom Tewari [<a href="mailto:vyom.tewari@oracle.com" class="">mailto:vyom.tewari@oracle.com</a>]<span class="Apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Wednesday, September 28, 2016 1:26 AM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Chris Hegarty <<a href="mailto:chris.hegarty@oracle.com" class="">chris.hegarty@oracle.com</a>>; Mark Sheppard <<a href="mailto:mark.sheppard@oracle.com" class="">mark.sheppard@oracle.com</a>>; net-dev <<a href="mailto:net-dev@openjdk.java.net" class="">net-dev@openjdk.java.net</a>>; Kaczmarek, Eric <<a href="mailto:eric.kaczmarek@intel.com" class="">eric.kaczmarek@intel.com</a>>; Viswanathan, Sandhya <<a href="mailto:sandhya.viswanathan@intel.com" class="">sandhya.viswanathan@intel.com</a>>; Kharbas, Kishor <<a href="mailto:kishor.kharbas@intel.com" class="">kishor.kharbas@intel.com</a>>; Aundhe, Shirish <<a href="mailto:shirish.aundhe@intel.com" class="">shirish.aundhe@intel.com</a>>; Lu, Yingqi <<a href="mailto:yingqi.lu@intel.com" class="">yingqi.lu@intel.com</a>><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: RFR 8153674: Expected SocketException not thrown when calling bind() with setReuseAddress(false)<o:p class=""></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi All,<o:p class=""></o:p></p><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">I had off line discussion here at Oracle and we decided  not to override getReuseAddr/setReuseAddr for MulticastSocket. If user wants, he can set the SO_REUSEPORT with "setOption"<span class="new"><span class="Apple-converted-space"> </span>before bind.</span><o:p class=""></o:p></p><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span class="new">For MulticastSocket<span class="Apple-converted-space"> </span></span>SO_REUSEADDR&SO_REUSEPORT are semantically equivalent which means either option will be sufficient to indicate that the address&port is reusable. So setting SO_REUSEPORT in constructor is really necessary/required ?<o:p class=""></o:p></p><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span class="new">I am looking some comments on this from Intel people(they are in mail chain) who did this original change, before we decide how we wants to proceed on this issue.</span><o:p class=""></o:p></p><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span class="new">Thanks,</span><o:p class=""></o:p></p><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span class="new">Vyom</span><o:p class=""></o:p></p><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Wednesday 14 September 2016 08:47 PM, Chris Hegarty wrote:<o:p class=""></o:p></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On 14/09/16 15:53, Mark Sheppard wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">that's true wrt SO_REUSEPORT in MulticastSocket constructor. But the<span class="Apple-converted-space"> </span><br class="">same could have been argued for the original<span class="Apple-converted-space"> </span><br class="">invocation of setReuseAddress, by default , in the constructors, which<span class="Apple-converted-space"> </span><br class="">is encapsulating, what pereceived as, common or defacto<span class="Apple-converted-space"> </span><br class="">practice wrt applying SO_REUSEADDR on mcast sockets at the system level.<span class="Apple-converted-space"> </span><br class="">As I understand it, it is generally perceived that SO_REUSEADDR and<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT are semantically equivalent for multicast sockets.<span class="Apple-converted-space"> </span><br class="">As such, I think in the case of MulticastSocket, the fact that the<span class="Apple-converted-space"> </span><br class="">setRuseAddress() is called in the constructor, it is appropriate<span class="Apple-converted-space"> </span><br class="">to set SO_REUSEPORT also when it exists in the OS.<span class="Apple-converted-space"> </span><br class=""><br class="">I take your point on the semantics of setReuseAddress in DatagramSocket<span class="Apple-converted-space"> </span><br class="">as per its spec. The spec does allude to MulticastSocket.<span class="Apple-converted-space"> </span><br class="">As such, the current proposal's changes just lack the appropriate<span class="Apple-converted-space"> </span><br class="">javadoc to describe its behavior, and its additional functionality of<span class="Apple-converted-space"> </span><br class="">setting SO_REUSEPORT.<span class="Apple-converted-space"> </span><br class="">It is not necessary that overridden method should mirror the semantics<span class="Apple-converted-space"> </span><br class="">of the base class method.<span class="Apple-converted-space"> </span><br class="">If it is accepted that it is generally perceived that SO_REUSEADDR and<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT are semantically equivalent for multicast sockets,<span class="Apple-converted-space"> </span><br class="">then it seems appropriate that an overriding setReuseAddress(..) method<span class="Apple-converted-space"> </span><br class="">in MulticastSocket can reflect this.<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">That sounds reasonable.<span class="Apple-converted-space"> </span><br class=""><br class="">-Chris.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">regards<span class="Apple-converted-space"> </span><br class="">Mark<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class="">On 14/09/2016 14:58, Chris Hegarty wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">One additional remark.<span class="Apple-converted-space"> </span><br class=""><br class="">Was it appropriate to update the legacy MC constructors<span class="Apple-converted-space"> </span><br class="">to set the new JDK 9 SO_REUSEPORT in the first place?<span class="Apple-converted-space"> </span><br class="">This can be achievable, opt-in from new code, by creating<span class="Apple-converted-space"> </span><br class="">an unbound MS, setting the option, then binding.<span class="Apple-converted-space"> </span><br class=""><br class="">-Chris.<span class="Apple-converted-space"> </span><br class=""><br class="">On 14/09/16 14:47, Chris Hegarty wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Mark,<span class="Apple-converted-space"> </span><br class=""><br class="">On 14/09/16 14:22, Mark Sheppard wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">Hi Chris,<span class="Apple-converted-space"> </span><br class="">     I don't fully understand your objections to the approach taken.<span class="Apple-converted-space"> </span><br class="">Is there a compatibility issue with the addition of the additional<span class="Apple-converted-space"> </span><br class="">methods to MulticastSocket?<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">The concern is with setReuseAddress performing an operation that<span class="Apple-converted-space"> </span><br class="">is not clear from the method specification, e.g. from setReuseAddress()<span class="Apple-converted-space"> </span><br class=""><br class="">     * Enable/disable the SO_REUSEADDR socket option.<span class="Apple-converted-space"> </span><br class=""><br class="">This is no longer accurate. The proposed changes would affect<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT too.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">I don't see Datagram.setReuseAddress(...) handling the SO_REUSEPORT<span class="Apple-converted-space"> </span><br class="">option, this has to be done explicitly via setOption at this level of<span class="Apple-converted-space"> </span><br class="">abstraction.<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">Yes, it is a bit odd, but these are legacy classes. I am not opposed<span class="Apple-converted-space"> </span><br class="">to adding a new method for this, or something else. I just want to<span class="Apple-converted-space"> </span><br class="">avoid future issues and confusion when setReuseAddress is called and<span class="Apple-converted-space"> </span><br class="">then it is noticed that, the somewhat orthogonal option, SO_REUSEPORT's<span class="Apple-converted-space"> </span><br class="">value has changed. setReuseAddress's spec is very clear about what it<span class="Apple-converted-space"> </span><br class="">does.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">MulticastSocket is a subclass of DatagramSocket (that in itself is a<span class="Apple-converted-space"> </span><br class="">questionable structuring), and as such<span class="Apple-converted-space"> </span><br class="">has specialized behaviour, and part  of that specialization is the<span class="Apple-converted-space"> </span><br class="">setting of  the setting SO_REUSEADDR and SO_REUSEPORT<span class="Apple-converted-space"> </span><br class="">in its constructors, to enable address reuse semantics, prior to<span class="Apple-converted-space"> </span><br class="">binding<span class="Apple-converted-space"> </span><br class="">an address.<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">Understood. Of course, the setting of SO_REUSEPORT is new in 9,<span class="Apple-converted-space"> </span><br class="">hence the problem.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">As part of that specialization, it would seem appropriate that<span class="Apple-converted-space"> </span><br class="">MulticastSocket manipulate the SO_REUSEPORT<span class="Apple-converted-space"> </span><br class="">option in a consistent way. Adding an overridden setReuseAddress(...)<span class="Apple-converted-space"> </span><br class="">method provides that consistency and<span class="Apple-converted-space"> </span><br class="">encapsulates the specialized behaviour.<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">I agree with the abstraction, just not that setReuseAddress should<span class="Apple-converted-space"> </span><br class="">be used to achieve it. The name and spec of this method is so<span class="Apple-converted-space"> </span><br class="">tied to SO_REUSEADDR.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Is alternatively proposal to NOT do anything to MulticastSocket, BUT<span class="Apple-converted-space"> </span><br class="">document clearly how to handle the failing scenario, that an<span class="Apple-converted-space"> </span><br class="">MulticastSocket<span class="Apple-converted-space"> </span><br class="">requires both setReuseAddress() and a setOption call to disable<span class="Apple-converted-space"> </span><br class="">reuseaddress semantics on an unbound MulticastSocket ?<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">That is one option, and the option that I was suggesting as a possible<span class="Apple-converted-space"> </span><br class="">alternative.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">This then raises the question of why have a convenience method, such as<span class="Apple-converted-space"> </span><br class="">setReuseAddress() in the first place, when it can be handled<span class="Apple-converted-space"> </span><br class="">adequately via the setOption<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">We are moving away from these option specific getter and setter<span class="Apple-converted-space"> </span><br class="">methods, in favor of the more general get/setOption methods, as<span class="Apple-converted-space"> </span><br class="">the latter are more adaptable.<span class="Apple-converted-space"> </span><br class=""><br class="">If setReuseAddress is to operate on more than SO_REUSEADDR, then<span class="Apple-converted-space"> </span><br class="">its spec should be very clear about this.<span class="Apple-converted-space"> </span><br class=""><br class="">-Chris.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">regards<span class="Apple-converted-space"> </span><br class="">Mark<span class="Apple-converted-space"> </span><br class=""><br class="">On 14/09/2016 13:34, Chris Hegarty wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Mark,<span class="Apple-converted-space"> </span><br class=""><br class="">On 14/09/16 13:23, Mark Sheppard wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">Hi Chris,<span class="Apple-converted-space"> </span><br class="">    so are you accepting that it is correct to add the overridden<span class="Apple-converted-space"> </span><br class="">methods in MulticastSocket and that these need<span class="Apple-converted-space"> </span><br class="">appropriate javadoc ?<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">I think we need these, but they should just call their super<span class="Apple-converted-space"> </span><br class="">equivalents, i.e. no implicit setting of SO_REUSEPORT. They would<span class="Apple-converted-space"> </span><br class="">exist solely as a place to locate guidance, or a note, that one<span class="Apple-converted-space"> </span><br class="">will likely want to set SO_REUSEPORT too.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">or are you advocating pushing the handing of the SO_REUSEPORT into<span class="Apple-converted-space"> </span><br class="">the<span class="Apple-converted-space"> </span><br class="">base DatagramSocket class ?<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">It is already there. I am not proposing to change this.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">It is not clear how your code changes fit in the proposed fix i.e.<span class="Apple-converted-space"> </span><br class="">the<span class="Apple-converted-space"> </span><br class="">explicit setting of the option to false?<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">My proposal is an alternative. It is not related to the current<span class="Apple-converted-space"> </span><br class="">webrev.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">With the current proposed changes then I think it would be<span class="Apple-converted-space"> </span><br class="">sufficient to<span class="Apple-converted-space"> </span><br class="">invoke setReuseAddress(true) in MulticastSocket constructors<span class="Apple-converted-space"> </span><br class="">rather than<span class="Apple-converted-space"> </span><br class=""><br class="">        // Enable SO_REUSEADDR before binding<span class="Apple-converted-space"> </span><br class="">        setReuseAddress<span class="Apple-converted-space"> </span><br class=""><a href="https://java.se.oracle.com/source/s?defs=setReuseAddress&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=setReuseAddress&project=jdk9-dev></a>(*true*);<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><br class="">        // Enable SO_REUSEPORT if supported before binding<span class="Apple-converted-space"> </span><br class="">        *if* (supportedOptions<span class="Apple-converted-space"> </span><br class=""><a href="https://java.se.oracle.com/source/xref/jdk9-dev/jdk/src/java.base/share/classes/java/net/MulticastSocket.java#supportedOptions" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/xref/jdk9-dev/jdk/src/java.base/share/classes/java/net/MulticastSocket.java#supportedOptions></a>().contains<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><a href="https://java.se.oracle.com/source/s?defs=contains&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=contains&project=jdk9-dev></a>(StandardSocketOptions<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><a href="https://java.se.oracle.com/source/s?defs=StandardSocketOptions&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=StandardSocketOptions&project=jdk9-dev></a>.SO_REUSEPORT<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><a href="https://java.se.oracle.com/source/s?defs=SO_REUSEPORT&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=SO_REUSEPORT&project=jdk9-dev></a>))<span class="Apple-converted-space"> </span><br class=""><br class=""><br class="">{<span class="Apple-converted-space"> </span><br class="">            *this*.setOption<span class="Apple-converted-space"> </span><br class=""><a href="https://java.se.oracle.com/source/s?defs=setOption&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=setOption&project=jdk9-dev></a>(StandardSocketOptions<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><a href="https://java.se.oracle.com/source/s?defs=StandardSocketOptions&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=StandardSocketOptions&project=jdk9-dev></a>.SO_REUSEPORT<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><a href="https://java.se.oracle.com/source/s?defs=SO_REUSEPORT&project=jdk9-dev" style="color: purple; text-decoration: underline;" class=""><https://java.se.oracle.com/source/s?defs=SO_REUSEPORT&project=jdk9-dev></a>,<span class="Apple-converted-space"> </span><br class=""><br class=""><br class="">*true*);<span class="Apple-converted-space"> </span><br class="">        }<span class="Apple-converted-space"> </span><br class=""><br class=""><br class="">as the overridden setReuseAddress takes care of SO_REUSEPORT<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">Yes, this is what Vyom has proposed, in the webrev.<span class="Apple-converted-space"> </span><br class=""><br class="">I would like to explore an alternative, so see what it would look<span class="Apple-converted-space"> </span><br class="">like.<span class="Apple-converted-space"> </span><br class=""><br class="">-Chris.<span class="Apple-converted-space"> </span><br class=""><br class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">regards<span class="Apple-converted-space"> </span><br class="">Mark<span class="Apple-converted-space"> </span><br class=""><br class="">On 14/09/2016 11:43, Chris Hegarty wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Vyom,<span class="Apple-converted-space"> </span><br class=""><br class="">On 11/09/16 08:01, Vyom Tewari wrote:<span class="Apple-converted-space"> </span><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi All,<span class="Apple-converted-space"> </span><br class=""><br class="">Please review the below code change.<span class="Apple-converted-space"> </span><br class=""><br class="">Bug        :<span class="Apple-converted-space"> </span><a href="https://bugs.openjdk.java.net/browse/JDK-8153674" style="color: purple; text-decoration: underline;" class="">https://bugs.openjdk.java.net/browse/JDK-8153674</a><span class="Apple-converted-space"> </span><br class=""><br class="">Webrev  :<span class="Apple-converted-space"> </span><br class=""><a href="http://cr.openjdk.java.net/%7Evtewari/8153674/webrev0.0/index.html" style="color: purple; text-decoration: underline;" class="">http://cr.openjdk.java.net/~vtewari/8153674/webrev0.0/index.html</a><span class="Apple-converted-space"> </span><br class=""><a href="http://cr.openjdk.java.net/%7Evtewari/8153674/webrev0.0/index.html" style="color: purple; text-decoration: underline;" class=""><http://cr.openjdk.java.net/%7Evtewari/8153674/webrev0.0/index.html></a><br class=""><br class=""><br class="">This change override the "get/setReuseAddress"  for MulticaseSocket<span class="Apple-converted-space"> </span><br class="">and<span class="Apple-converted-space"> </span><br class="">will abstract with both reuse attributes(SO_REUSEADDR &<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT).<span class="Apple-converted-space"> </span><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class="">This issue arises since the changes for 6432031 "Add support for<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT" [1], which sets SO_REUSEPORT on MulticastSocket, if<span class="Apple-converted-space"> </span><br class="">the available. So setting setReuseAddress(false) alone is no longer<span class="Apple-converted-space"> </span><br class="">sufficient to disable address/port reuse, one must also set<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT to false.<span class="Apple-converted-space"> </span><br class=""><br class="">I would be really nervous about changing set/getReuseAddress,<span class="Apple-converted-space"> </span><br class="">without<span class="Apple-converted-space"> </span><br class="">at least updating the javadoc to indicate that it is now, for MS,<span class="Apple-converted-space"> </span><br class="">operating on two socket options.  Although, I do have sympathy<span class="Apple-converted-space"> </span><br class="">here since SO_REUSEPORT and SO_REUSEADDR are almost identical when<span class="Apple-converted-space"> </span><br class="">dealing with multicasting.<span class="Apple-converted-space"> </span><br class=""><br class="">An alternative, maybe; Since the MS constructors document that<span class="Apple-converted-space"> </span><br class="">SO_REUSEPORT will be set, where available, maybe a javadoc note<span class="Apple-converted-space"> </span><br class="">on the set/getReuseAddress methods would be sufficient, that<span class="Apple-converted-space"> </span><br class="">indicates that StandardSocketOptions#SO_REUSEPORT may also need<span class="Apple-converted-space"> </span><br class="">to be set to have the desired effect?<span class="Apple-converted-space"> </span><br class=""><br class="">If so, then code would have to:<span class="Apple-converted-space"> </span><br class=""><br class="">    setReuseAddress(false);<span class="Apple-converted-space"> </span><br class=""><br class="">    if<span class="Apple-converted-space"> </span><br class="">(supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT))<span class="Apple-converted-space"> </span><br class="">this.setOption(StandardSocketOptions.SO_REUSEPORT, false);<span class="Apple-converted-space"> </span><br class=""><br class="">  , but at least it is explicit.<span class="Apple-converted-space"> </span><br class=""><br class="">Q: not all MS constructors document that SO_REUSEPORT is set, but<span class="Apple-converted-space"> </span><br class="">they should, right? This seems to have slipped past during 6432031<span class="Apple-converted-space"> </span><br class="">[1].<span class="Apple-converted-space"> </span><br class=""><br class="">-Chris.<span class="Apple-converted-space"> </span><br class=""><br class="">[1]<span class="Apple-converted-space"> </span><a href="https://bugs.openjdk.java.net/browse/JDK-6432031" style="color: purple; text-decoration: underline;" class="">https://bugs.openjdk.java.net/browse/JDK-6432031</a><o:p class=""></o:p></div></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></blockquote></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></blockquote></blockquote></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></blockquote></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div></div></blockquote></div><br class=""></div></body></html>