On 13/04/2018 10:50, vyom tewari wrote:
Hi All,
Please review the below code.
BugId : https://bugs.openjdk.java.net/browse/JDK-8194298
webrev : http://cr.openjdk.java.net/~vtewari/8194298/webrev0.0/index.html
Currently Java supports SO_KEEPALIVE, whose default value is 7200
seconds which is too long for most of the applications. This code
change will allow us to set the keepalive
parameters(TCP_KEEPIDLE,TCP_KEEPCNT,TCP_KEEPINTVL) which will
configure the idle time on per socket basis.
I did code changes for Linux & Mac only, support for other platforms
can be added in future if needed.
Limiting this to specific platforms is okay but I think their
descriptions will need a bit to work to ensure there is enough wriggle
room to support varying behavior and also be somewhat consistent with
the wording that we use for other options. There are several points that
will need to expanded in the javadoc and maybe the style/wording in
java.net.StandardSocketOption#SO_KEEPALIVE would help get that somewhat
consistent -- e.g. initial value, can be set on unbound socket, can be
changed after being set, etc.
One concern is that you've chosen to support it on ServerSocket and
specify that it can be "inherited" by the sockets for accepted
connections. This isn't tested in the proposed tests and I'm wondering
if we would be saner to limit this to connected sockets.
Can you update SocketChannel/SocketOptionTests.java to ensure that
SocketChannel is test? We also need to ensure that the new options don't
show up in the supportedOptions returned by the channels that don't
support these new options.
In passing: The ordering of the modifiers in XXXSocketOptions looks a
bit odd, can this be changed to the more usual "private static native".
-Alan