On 23/11/2015 04:12, Lu, Yingqi wrote:
Hi Alan,
One more question please JI want to make sure I understand correctly
on your following suggestion. In order to use supportedOptions method
to test SO_REUSEPORT, I will need to first write a native function to
check if SO_REUSEPORT is supported. Then, in the defaultOptions
method, I do a conditional add for StandardSocketOptions.SO_REUSEPORT
if it is supported on the platform? Is this a preferred way to
implement? Please let me know!
Yes as supportedOptions() shouldn't return SO_REUSEPORT in the set when
it's not supported. It might be simplest to put that code in
sun.nio.ch.Net, maybe isReusePortSupported or some such method. In the
implementation (Net.c) then you can return true or false depending on
the platform and maybe kernel version.
-Alan