(incubating) | The Free and Open Productivity Suite
Announcing Apache OpenOffice 3.4
OOoRunner test harness

util
Class WaitUnreachable

java.lang.Object
  |
  +--util.WaitUnreachable

public final class WaitUnreachable
extends Object

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

WaitUnreachable

public WaitUnreachable(Object obj)
Creates a new waiter.
Parameters:
obj - the object on which to wait
Method Detail

get

public Object get()
Gets the object on which to wait.
Returns:
the object on which to wait, or null if waitUnreachable has already been called

waitUnreachable

public void waitUnreachable()
Starts waiting for the object to become unreachable.

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.


ensureFinalization

public static void ensureFinalization(Object obj)
Ensures that an object will be finalized as soon as possible.

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.

Parameters:
obj - the object of which to ensure finalization

OOoRunner test harness

Apache Feather

Copyright & License | Privacy | Contact Us

Apache and the Apache feather logos are trademarks of The Apache Software Foundation. OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.

Apache OpenOffice is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.