Code example for PhantomReference

Methods: isEnqueued, sleep

0
                assertNotNull("Reference should have been enqueued.", r);
            } 
 
            // These are to make sure that tprs and its elements don't get 
            // optimized out. 
            assertNull("get() should return null.", tprs[0].get());
            assertNull("get() should return null.", tprs[1].get());
            assertNull("get() should return null.", tprs[2].get());
            assertNull("get() should return null.", tprs[3].get());
        } catch (InterruptedException e) {
            fail("InterruptedException : " + e.getMessage());
        } 
    } 
 
    /** 
     * @tests java.lang.ref.PhantomReference#PhantomReference(java.lang.Object, 
     *        java.lang.ref.ReferenceQueue) 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "",