public class CloseWatcher extends PhantomReference<Object>
Modifier and Type | Field and Description |
---|---|
static ReferenceQueue<Object> |
queue
The queue (might be set to null at any time).
|
static HashSet<CloseWatcher> |
refs
The reference set.
|
Constructor and Description |
---|
CloseWatcher(Object referent,
ReferenceQueue<Object> q,
Closeable closeable) |
Modifier and Type | Method and Description |
---|---|
Closeable |
getCloseable() |
String |
getOpenStackTrace()
Get the open stack trace or null if none.
|
static CloseWatcher |
pollUnclosed()
Check for an collected object.
|
static CloseWatcher |
register(Object o,
Closeable closeable,
boolean stackTrace)
Register an object.
|
static void |
unregister(CloseWatcher w)
Unregister an object, so it is no longer tracked.
|
get
clear, enqueue, isEnqueued
public static ReferenceQueue<Object> queue
public static HashSet<CloseWatcher> refs
public CloseWatcher(Object referent, ReferenceQueue<Object> q, Closeable closeable)
public static CloseWatcher pollUnclosed()
public static CloseWatcher register(Object o, 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 String getOpenStackTrace()
public Closeable getCloseable()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.