RFR: 8253119: Remove the legacy PlainSocketImpl and PlainDatagramSocketImpl implementation

Alan Bateman alanb at openjdk.java.net
Wed Jun 23 13:12:31 UTC 2021


On Wed, 23 Jun 2021 12:06:41 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:

> Hi,
> 
> Could someone please review my changes for the removal of the legacy `PlainSocketImpl` and `PlainDatagramSocketImpl` implementations?
> 
> In JDK 13, JEP 353 provided a drop in replacement for the legacy `PlainSocketImpl` implementation. Since JDK 13, the `PlainSocketImpl` implementation was no longer used but included a mitigation mechanism to reduce compatibility risks in the form of a JDK-specific property `jdk.net.usePlainSocketImpl` allowing to switch back to the old implementation. 
> Similarly, in JDK 15, JEP 373 provided a new implementation for `DatagramSocket` and `MulticastSocket`, with a JDK-specific property `jdk.net.usePlainDatagramSocketImpl` also allowing the user to switch back to the old implementation in case of compatibility issue.
> 
> As these implementations (and the mechanisms they use to enable them to mitigate compatibility issues) have been deemed no longer necessary, they now represent a maintenance burden. This patch looks at removing them from the JDK.
> 
> Kind regards,
> Patrick

I assume DatagramSocket L1043-L1049 (declaration/init of USE_PLAINDATAGRAMSOCKET) can be removed too.

src/java.base/share/classes/java/net/DatagramSocket.java line 1405:

> 1403:                 // create legacy DatagramSocket delegate
> 1404:                 DatagramSocketImpl impl = factory.createDatagramSocketImpl();
> 1405:                 Objects.requireNonNull(impl);

I assume this Objects.requireNonNull is not needed or maybe you want to detect a buggy factory rather than in the the constructor?

src/jdk.jdwp.agent/windows/native/libdt_socket/socket_md.c line 269:

> 267: 
> 268: /*
> 269:  * Below Adapted from PlainSocketImpl.c (removed in JDK18), win32 version 1.18.

I think we'll need decide whether to keep this comment or not, I would be tempted to re-write it.

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

PR: https://git.openjdk.java.net/jdk/pull/4574


More information about the nio-dev mailing list