8236925: (dc) Upgrade DatagramChannel socket adaptor to extend MulticastSocket

Chris Hegarty chris.hegarty at oracle.com
Thu Jan 16 11:45:22 UTC 2020

> On 14 Jan 2020, at 19:23, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> ...
> Here's the updated webrev that changes oldImpl to be final.
>    http://cr.openjdk.java.net/~alanb/8236925/2/webrev/

Generally, I agree with updating the socket adapter to support
multicast. It will certainly help with future work in this area.

The instanceof checks in the constructors highlight that there is an
abstraction missing here - to support creating a custom MulticastSocket
implementation. If / When DatagramSocketImpl is deprecated, the advise
will likely be to subclass MulticastSocket if one wants to provide a
custom implementation. I believe that this cannot be done efficiently
with the current API - and that is the issue that this change is running
into that results in the instanceof checks in the constructors.

I'm not suggesting adding an overloaded constructor that takes a
DatagramSocketImpl. I don't believe that that is the right solution
here, but I do think that we need to solve the general problem, then
this change could use whatever solution is arrived at.


More information about the nio-dev mailing list