org.ros.concurrent
Class Holder<T>
java.lang.Object
org.ros.concurrent.Holder<T>
public class Holder<T>
- extends java.lang.Object
A mutable object that may contain a value to another object. It is modifiable
exactly once and must hold a non-null value when the value is inspected.
Holder
s are intended for receiving a result from an anonymous class.
Note that Holder
is not thread safe. For a thread safe
implementation, use AtomicReference
. Also note that two different
Holder
instances are never considered equal.
Method Summary |
void |
await()
|
boolean |
await(long timeout,
java.util.concurrent.TimeUnit unit)
|
boolean |
equals(java.lang.Object obj)
|
T |
get()
|
static
|
newEmpty()
|
T |
set(T value)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
newEmpty
public static <T> Holder<T> newEmpty()
set
public T set(T value)
get
public T get()
await
public void await()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
await
public boolean await(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object