8234805: (dc) Remove JNI upcall from DatagramChannel.receive implementation

Alan Bateman Alan.Bateman at oracle.com
Tue Nov 26 13:22:51 UTC 2019


This is a patch to replace the JNI upcall in the implementation of 
DatagramChannel.receive so that the sender SocketAddress is created in 
Java rather in the native method. This is the issue that was discussed 
here last year [1]. The replacement marginally improves the single 
source case, significantly improves the multiple source case.  I've 
created an issue to add tests to the micro benchmark suite as this an 
area that lacks benchmarks (Martin Thompson did send benchmarks in the 
2018 thread but we couldn't include them without the OCA).

The webrev with the changes are here. NativeSocketAddres will be a good 
candidate to replace with the new foreign-memory access API if/when it 
is promoted from incubating module. The test in the webrev is to add 
variety to the source address scenarios.

http://cr.openjdk.java.net/~alanb/8234805/webrev/

-Alan

[1] https://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005383.html
[2] https://bugs.openjdk.java.net/browse/JDK-8234812


More information about the nio-dev mailing list