-
Enhancement
-
Resolution: Fixed
-
P4
-
16
-
b28
Reference.isEnqueued is being deprecated (JDK-8052260). There are a couple of tests that use it and should be updated.
The test vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java uses Reference.isEnqueued() to detect whether the GC has cleared and notified Reference objects. Because of timing issues, it's probably possible for these to not work as intended, since the references might not make it to their respective queues immediately. Better would be to use the recently added Reference.refersTo with a null argument.
The test jdk/java/lang/ref/ReferenceEnqueue.java also uses Reference.isEnqueued, again in a way that is subject to timing issues. It could instead use Reference.refersTo and ReferenceQueue.remove with a timeout.
vmTestBase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java also uses isEnqueued. This can also be dealt with by using ReferenceQueue.remove with a timeout.
The test vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java uses Reference.isEnqueued() to detect whether the GC has cleared and notified Reference objects. Because of timing issues, it's probably possible for these to not work as intended, since the references might not make it to their respective queues immediately. Better would be to use the recently added Reference.refersTo with a null argument.
The test jdk/java/lang/ref/ReferenceEnqueue.java also uses Reference.isEnqueued, again in a way that is subject to timing issues. It could instead use Reference.refersTo and ReferenceQueue.remove with a timeout.
vmTestBase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java also uses isEnqueued. This can also be dealt with by using ReferenceQueue.remove with a timeout.
- relates to
-
JDK-8258047 Improve vmTestbase/gc/gctests/WeakReferenceGC
- Open
-
JDK-8052260 Reference.isEnqueued() spec does not match the long-standing behavior returning true iff it's in the ref queue
- Resolved