RFR: 8266369: (se) Add wepoll based Selector [v2]
Chris Hegarty
chegar at openjdk.java.net
Wed May 5 15:16:59 UTC 2021
On Wed, 5 May 2021 09:59:25 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> src/java.base/share/classes/sun/nio/ch/Net.java line 685:
>>
>>> 683: * Read and discard urgent data (MSG_OOB) on the socket.
>>> 684: */
>>> 685: static native boolean discardOOB(FileDescriptor fd) throws IOException;
>>
>> I see a native implementation of this method on Windows only, but it is in the shared `Net` class. This method is not called on non-Windows, but it it were there would be a problems ;-). Was the intention to add other platform specific implementations, or to confine it to Windows only?
>
> It often happens in this area that Net and IOUtil define methods that aren't implemented on all platforms. In this case, discardOOB is generally useful and we can add it on other platforms when needed. I didn't add it now because it would not be used or tested.
This attracted my attention because it is a new native method. I don't see any other native methods unimplemented here, but I only skimmed over the code. Seems very fragile, since it will (may) throw a linkage error if called on non-Windows platforms - without any help from the compiler, we are dependent on good tests to catch such. If this is an established pattern, then ok, but I would like to revisit it separately to this PR.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3816
More information about the nio-dev
mailing list