java.lang.ref.Cleaner
.
Modifier and Type | Class and Description |
---|---|
pack-priv static class | CleanerImpl.
A PhantomCleanable implementation for tracking the Cleaner itself. |
pack-priv static class | CleanerImpl.
A ThreadFactory for InnocuousThreads. |
public static class | CleanerImpl.
Perform cleaning on an unreachable PhantomReference. |
Modifier and Type | Field and Description |
---|---|
private static Function | cleanerImplAccess
An object to access the CleanerImpl from a Cleaner; set by Cleaner init. |
pack-priv final PhantomCleanable | phantomCleanableList
Heads of a CleanableList for each reference type. |
pack-priv final ReferenceQueue |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
pack-priv static CleanerImpl | Returns: the corresponding CleanerImplthe cleaner cleaner)Called to get the CleanerImpl for a Cleaner. |
public void | run()
Implements java. Process queued Cleanables as long as the cleanable lists are not empty. |
public static void | setCleanerImplAccess(Function<Cleaner, CleanerImpl>
a function to map from Cleaner to CleanerImpl access)Called by Cleaner static initialization to provide the function to map from Cleaner to CleanerImpl. |
public void | start(Cleaner
the cleaner cleaner, ThreadFactory the thread factory threadFactory)Starts the Cleaner implementation. |
cleanerImplAccess | back to summary |
---|---|
private static Function<Cleaner, CleanerImpl> cleanerImplAccess An object to access the CleanerImpl from a Cleaner; set by Cleaner init. |
phantomCleanableList | back to summary |
---|---|
pack-priv final PhantomCleanable<?> phantomCleanableList Heads of a CleanableList for each reference type. |
queue | back to summary |
---|---|
pack-priv final ReferenceQueue<Object> queue |
CleanerImpl | back to summary |
---|---|
public CleanerImpl() Constructor for CleanerImpl. |
getCleanerImpl | back to summary |
---|---|
pack-priv static CleanerImpl getCleanerImpl(Cleaner cleaner) Called to get the CleanerImpl for a Cleaner.
|
run | back to summary |
---|---|
public void run() Implements java. Process queued Cleanables as long as the cleanable lists are not empty. A Cleanable is in one of the lists for each Object and for the Cleaner itself. Terminates when the Cleaner is no longer reachable and has been cleaned and there are no more Cleanable instances for which the object is reachable. If the thread is a ManagedLocalsThread, the threadlocals are erased before each cleanup
|
setCleanerImplAccess | back to summary |
---|---|
public static void setCleanerImplAccess(Function<Cleaner, CleanerImpl> access) Called by Cleaner static initialization to provide the function to map from Cleaner to CleanerImpl.
|
start | back to summary |
---|---|
public void start(Cleaner cleaner, ThreadFactory threadFactory) Starts the Cleaner implementation. Ensure this is the CleanerImpl for the Cleaner. When started waits for Cleanables to be queued.
|
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
protected void | performCleanup()
Implements abstract jdk. The |
CleanerCleanable | back to summary |
---|---|
pack-priv CleanerCleanable(Cleaner cleaner) |
performCleanup | back to summary |
---|---|
protected void performCleanup() Implements abstract jdk. Doc from jdk. The
|
Modifier and Type | Field and Description |
---|---|
pack-priv final AtomicInteger | |
pack-priv static final ThreadFactory |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
pack-priv static ThreadFactory | |
public Thread | newThread(Runnable
a runnable to be executed by new thread instance r)Implements java. Constructs a new unstarted |
cleanerThreadNumber | back to summary |
---|---|
pack-priv final AtomicInteger cleanerThreadNumber |
factory | back to summary |
---|---|
pack-priv static final ThreadFactory factory |
InnocuousThreadFactory | back to summary |
---|---|
pack-priv InnocuousThreadFactory() |
factory | back to summary |
---|---|
pack-priv static ThreadFactory factory() |
newThread | back to summary |
---|---|
public Thread newThread(Runnable r) Implements java. Doc from java. Constructs a new unstarted |
Modifier and Type | Field and Description |
---|---|
private final Runnable |
Access | Constructor and Description |
---|---|
public | PhantomCleanableRef(Object
the object to monitor obj, Cleaner the cleaner cleaner, Runnable the action Runnable action)Constructor for a phantom cleanable reference. |
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void | clear()
Overrides jdk. Direct clearing of the referent is not supported. |
public Object | get()
Overrides java. Prevent access to referent even when it is still alive. |
protected void | performCleanup()
Implements abstract jdk. The |
action | back to summary |
---|---|
private final Runnable action |
PhantomCleanableRef | back to summary |
---|---|
public PhantomCleanableRef(Object obj, Cleaner cleaner, Runnable action) Constructor for a phantom cleanable reference. |
PhantomCleanableRef | back to summary |
---|---|
pack-priv PhantomCleanableRef() Constructor used only for root of phantom cleanable list. |
clear | back to summary |
---|---|
public void clear() Overrides jdk. Direct clearing of the referent is not supported.
|
get | back to summary |
---|---|
public Object get() Overrides java. Prevent access to referent even when it is still alive.
|
performCleanup | back to summary |
---|---|
protected void performCleanup() Implements abstract jdk. Doc from jdk. The
|