RFR(s) #2: 6344935: (spec) clarify specifications for Object.wait overloads

Martin Buchholz martinrb at google.com
Fri Aug 25 18:34:02 UTC 2017

Stuart, you have my blessing to commit what you have, even though both your
reviewers are still nitpicking that wait loop.

The thing that bothers me in

         while (<condition does not hold> and <timeout not exceeded>) {
             long timeout = ... ; // recompute timeout values

is that you can't check for <timeout not exceeded> until you've done
the "recompute
timeout values", so a straightforward improvement (?) should be:

         while (<condition does not hold>) {
             long timeout = ... ; // (re)compute timeout values
             int nanos = ... ;

             if (<timeout exceeded>) ... // handle timeout

             obj.wait(timeout, nanos);

(but real code would be messier, because you're not working in nanos)

More information about the core-libs-dev mailing list