NIO based SocketImpl to replace legacy PlainSocketImpl

Alan Bateman Alan.Bateman at oracle.com
Mon Apr 8 11:34:32 UTC 2019


Just a quick summary on where we are on this effort.

I've submitted the JEP [1] so it can be considered for the roadmap. 
There wasn't any additional feedback from the draft that I sent here in 
February.

In the mean-time, the "preparatory" changes have been pushed to jdk/jdk:

JDK-8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
JDK-8221259: New tests for java.net.Socket to exercise long standing 
behavior
JDK-8220738: (sc) Move ServerSocketChannelImpl remaining native method 
to Net
JDK-8217500: (sc) Move SocketChannelImpl's remaining native methods to Net
JDK_8221252: (sc) SocketChannel and its socket adaptor need to handle 
connection reset
JDK-8217461: (sc) Add Net.available to return the number of bytes in the 
socket input buffer
JDK-8217451: ExtendedSocketOptions should encapsulate support for 
SO_FLOW_SLA
JDK-8219446: Specify behaviour of timeout accepting methods of Socket 
and ServerSocket if timeout is negative

and the CSR [2] has been removed to "Provisional".

Getting the enabling changes pushed in advance means the changes are 
significantly reduced and are mostly one class with the new 
implementation. A snapshot of the patch from the niosocketimpl-branch is 
here:
   http://cr.openjdk.java.net/~alanb/8221481/0/webrev/index.html

If the JEP becomes a candidate then then changes will need Reviewers. We 
will also need to decide on the system property to configure the JDK to 
use the legacy implementation. At this time, you can run with 
-Djdk.net.usePlainSocketImpl=true to use the legacy PlainSocketImpl. It 
probably not wroth spending time on anything more sophisticated.

In addition to the above patch, the niosocketimpl-branch has updates to 
several existing socket tests to run them a second time with 
-Djdk.net.usePlainSocketImpl. I left them out of the above snapshot to 
avoid clutter as it's a one-line to each test description. As documented 
in the JEP, the motive is to avoid the legacy implementation bit rotting 
before it is removed. The niosocketimpl-branch also has Sergey 
Kuksenko's updates to the socket micros which may make it to the main 
line in advance of the changes.

-Alan.

[1] http://openjdk.java.net/jeps/8218559
[2] https://bugs.openjdk.java.net/browse/JDK-8222028


More information about the nio-dev mailing list