public final class RefWatcher
extends java.lang.Object
RefWatcher detects that
a reference might not be weakly reachable when it should, it triggers the HeapDumper.
This class is thread-safe: you can call watch(Object) from any thread.
| Modifier and Type | Field and Description |
|---|---|
static RefWatcher |
DISABLED |
| Modifier and Type | Method and Description |
|---|---|
void |
clearWatchedReferences()
LeakCanary will stop watching any references that were passed to
watch(Object, String)
so far. |
void |
watch(java.lang.Object watchedReference)
Identical to
watch(Object, String) with an empty string reference name. |
void |
watch(java.lang.Object watchedReference,
java.lang.String referenceName)
Watches the provided references and checks if it can be GCed.
|
public static final RefWatcher DISABLED
public void watch(java.lang.Object watchedReference)
watch(Object, String) with an empty string reference name.watch(Object, String)public void watch(java.lang.Object watchedReference,
java.lang.String referenceName)
WatchExecutor this RefWatcher has been constructed
with.referenceName - An logical identifier for the watched object.public void clearWatchedReferences()
watch(Object, String)
so far.