Skip to content

Commit 214272a

Browse files
committed
Replace deprecated Weak Reference check with designated replacement. (#765)
"This method was originally specified to test if a reference object has been cleared and enqueued but was never implemented to do this test. This method could be misused due to the inherent race condition or without an associated `ReferenceQueue`. An application relying on this method to release critical resources could cause serious performance issue. An application should use `ReferenceQueue` to reliably determine what reference objects that have been enqueued or `refersTo(null)` to determine if this reference object has been cleared." -------- * JDK 21: "warning: [deprecation] isEnqueued() in Reference has been deprecated"
1 parent 1eae654 commit 214272a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

metafacture-triples/src/test/java/org/metafacture/triples/AbstractTripleSortTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void issue192ShouldUnregisterFromTheJVMToNotCauseMemoryLeak() throws Inte
7777
// Wait a tiny bit since GC Thread is not immediately done in Java 8
7878
Thread.sleep(10);
7979

80-
Assert.assertTrue(weakRef.isEnqueued());
80+
Assert.assertTrue(weakRef.refersTo(null));
8181
}
8282

8383
}

0 commit comments

Comments
 (0)