ReferenceQueue.remove() should not time out prematurely

Manually cherrypicked from jdk9, without the associated test.

This tolerates early wakeups from the wait() call, such as when
another thread successfully calls remove.

For the sake if upstream compatibility, we continue to use a separate lock
object for synchronization, though that is probably not really necessary
anymore.

Hg Changeset 9347:0731952efb10

  6853696: (ref) ReferenceQueue.remove(timeout) may return null even
           if timeout has not expired
  Reviewed-by: mchung, mduigou, rriggs
  author  igerasim
  date    Thu, 27 Feb 2014 02:44:04 +0400 (21 months ago)
  parents 4273927396c9
  children afc51ec63594

Bug: 25893944
Change-Id: Ie72920a46a2d3d8dc423763851a7f9c3da5efcd6
1 file changed