< prev index next >
src/java.base/share/classes/sun/misc/Cleaner.java
Print this page
*** 58,73 ****
public class Cleaner
extends PhantomReference<Object>
{
- // Dummy reference queue, needed because the PhantomReference constructor
- // insists that we pass a queue. Nothing will ever be placed on this queue
- // since the reference handler invokes cleaners explicitly.
- //
- private static final ReferenceQueue<Object> dummyQueue = new ReferenceQueue<>();
-
// Doubly-linked list of live cleaners, which prevents the cleaners
// themselves from being GC'd before their referents
//
static private Cleaner first = null;
--- 58,67 ----
*** 110,120 ****
}
private final Runnable thunk;
private Cleaner(Object referent, Runnable thunk) {
! super(referent, dummyQueue);
this.thunk = thunk;
}
/**
* Creates a new cleaner.
--- 104,114 ----
}
private final Runnable thunk;
private Cleaner(Object referent, Runnable thunk) {
! super(referent, null);
this.thunk = thunk;
}
/**
* Creates a new cleaner.
< prev index next >