public class CloseWatcher
extends java.lang.ref.PhantomReference<java.lang.Object>
| Constructor and Description |
|---|
CloseWatcher(java.lang.Object referent,
java.lang.ref.ReferenceQueue<java.lang.Object> q,
java.io.Closeable closeable) |
| Modifier and Type | Method and Description |
|---|---|
java.io.Closeable |
getCloseable() |
java.lang.String |
getOpenStackTrace()
Get the open stack trace or null if none.
|
static CloseWatcher |
pollUnclosed()
Check for an collected object.
|
static CloseWatcher |
register(java.lang.Object o,
java.io.Closeable closeable,
boolean stackTrace)
Register an object.
|
static void |
unregister(CloseWatcher w)
Unregister an object, so it is no longer tracked.
|
public CloseWatcher(java.lang.Object referent,
java.lang.ref.ReferenceQueue<java.lang.Object> q,
java.io.Closeable closeable)
public static CloseWatcher pollUnclosed()
public static CloseWatcher register(java.lang.Object o, java.io.Closeable closeable, boolean stackTrace)
o - the objectcloseable - the object to closestackTrace - whether the stack trace should be registered (this is
relatively slow)public static void unregister(CloseWatcher w)
w - the referencepublic java.lang.String getOpenStackTrace()
public java.io.Closeable getCloseable()