private final class ResourceLeakDetector.DefaultResourceLeak extends java.lang.ref.PhantomReference<java.lang.Object> implements ResourceLeak
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
creationRecord |
private java.util.concurrent.atomic.AtomicBoolean |
freed |
private java.util.Deque<java.lang.String> |
lastRecords |
private ResourceLeakDetector.DefaultResourceLeak |
next |
private ResourceLeakDetector.DefaultResourceLeak |
prev |
private int |
removedRecords |
Constructor and Description |
---|
DefaultResourceLeak(java.lang.Object referent) |
Modifier and Type | Method and Description |
---|---|
boolean |
close()
Close the leak so that
ResourceLeakDetector does not warn about leaked resources. |
void |
record()
Records the caller's current stack trace so that the
ResourceLeakDetector can tell where the leaked
resource was accessed lastly. |
java.lang.String |
toString() |
private final java.lang.String creationRecord
private final java.util.Deque<java.lang.String> lastRecords
private final java.util.concurrent.atomic.AtomicBoolean freed
private ResourceLeakDetector.DefaultResourceLeak prev
private ResourceLeakDetector.DefaultResourceLeak next
private int removedRecords
public void record()
ResourceLeak
ResourceLeakDetector
can tell where the leaked
resource was accessed lastly.record
in interface ResourceLeak
public boolean close()
ResourceLeak
ResourceLeakDetector
does not warn about leaked resources.close
in interface ResourceLeak
true
if called first time, false
if called alreadypublic java.lang.String toString()
toString
in class java.lang.Object