RFR [9] - 8060052: FutureTask; fix underflow when timeout = Long.MIN_VALUE

Jeff Hain jeffhain at rocketmail.com
Sat Oct 11 23:56:42 UTC 2014

Chris wrote:
>    http://cr.openjdk.java.net/~chegar/8060052/webrev.00/webrev/

An aside remark:

Every time some nanos timeout needs to be kept track of, and that
remaining time does not need to be returned, one could consider
the timeout to be infinite (timed = false) above, say, Long.MAX_VALUE/2
(not Long.MAX_VALUE, because some (actual) durations might be
subtracted from the specified timeout by intermediate treatments),
to get a small (in absolute) but relatively noticeable performance boost
on configurations where System.nanoTime() is slow.

In the curent case, if not wanting to have System.nanoTime() calls,
there is the get() method, but generic code might use get(long,TimeUnit)
even for huge timeouts.

Or maybe we don't want users to dangerously tinker around this
hidden and huge threshold...


More information about the core-libs-dev mailing list