|
OOoRunner test harness | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--util.WaitUnreachable
Wait until an object has become unreachable.
Instances of this class will typically be used as either:
SomeType o = new SomeType(...); ... // use "o" WaitUnreachable u = new WaitUnreachable(o); o = null; u.waitUnreachable();
or:
WaitUnreachable u = new WaitUnreachable(new SomeType(...)); ... // use "(SomeType) u.get()" u.waitUnreachable();
Constructor Summary | |
WaitUnreachable(Object obj)
Creates a new waiter. |
Method Summary | |
static void |
ensureFinalization(Object obj)
Ensures that an object will be finalized as soon as possible. |
Object |
get()
Gets the object on which to wait. |
void |
waitUnreachable()
Starts waiting for the object to become unreachable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WaitUnreachable(Object obj)
obj
- the object on which to waitMethod Detail |
public Object get()
null
if
waitUnreachable
has already been calledpublic void waitUnreachable()
This blocks the current thread until the object has become unreachable.
Actually, this method waits until the JVM has detected that the object has become unreachable. This is not deterministic, but this methods makes a best effort to cause the JVM to eventually detect the situation. With a typical JVM, this should suffice.
public static void ensureFinalization(Object obj)
This does not block the current thread. Instead, a new thread is spawned that busy waits for the given object to become unreachable.
This method cannot guarantee that the given object is eventually finalized, but it makes a best effort. With a typical JVM, this should suffice.
obj
- the object of which to ensure finalization
|
OOoRunner test harness | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |