JDK 9 RFR of 8165664: (ch) sun.nio.ch.SocketAdaptor does not respect timeout in case of system date/time change and blocks

Martin Buchholz martinrb at google.com
Mon Dec 19 20:08:13 UTC 2016

It's unfortunate the use of int millis timeout is baked into the API.

It's probably best (and traditional) to work with an internal long nanos
field anyways, so there are no millisecond sized roundoff errors.

I sometimes find it easier to understand if I define a deadline
final long deadline = System.nanoTime() + nanosTimeout;

I would do unit conversions using methods from TimeUnit.

On Mon, Dec 19, 2016 at 11:46 AM, Brian Burkhalter <
brian.burkhalter at oracle.com> wrote:

> Please review this simple change at your convenience.
> Issue:  https://bugs.openjdk.java.net/browse/JDK-8165664
> Patch:  http://cr.openjdk.java.net/~bpb/8165664/webrev.00/
> Change System.currentTimeMillis() to System.nanoTime()/1000000.
> Thanks,
> Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20161219/700f3e20/attachment.html>

More information about the nio-dev mailing list