public class CloseWatcher extends PhantomReference<Object>
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 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 © 2020 JBoss by Red Hat. All rights reserved.