|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.common.concurrent.BarrierReference<V>
V - the type of the referencepublic class BarrierReference<V>
An object reference, where threads can wait for changes.
| Constructor Summary | |
|---|---|
BarrierReference()
Creates a new instance with the starting value null. |
|
BarrierReference(V value)
Creates a new instance with the given starting value. |
|
| Method Summary | |
|---|---|
V |
awaitGet()
Waits for the reference to change, and returns the new value. |
V |
awaitGet(long timeout,
TimeUnit unit)
Waits for the reference to change within the given timeout, and returns the new value. |
V |
get()
Returns the current reference value immediately. |
void |
set(V newValue)
Sets the reference to a new value, waking up all other threads that wait for a change. |
V |
tryAwaitGet(V expected)
Waits for the reference to change, if the value is currently == the given expected value. |
V |
tryAwaitGet(V expected,
long timeout,
TimeUnit unit)
Waits for the reference to change within the given timeout, if the value is currently == the given expected value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BarrierReference()
public BarrierReference(V value)
value - initial value| Method Detail |
|---|
public final void set(V newValue)
newValue - the new reference valuepublic final V get()
public final V awaitGet()
throws InterruptedException
InterruptedException - the waiting task was interrupted
public final V awaitGet(long timeout,
TimeUnit unit)
throws InterruptedException,
TimeoutException
timeout - the maximum time to waitunit - the time unit of the timeout parameter
InterruptedException - the waiting task was interrupted
TimeoutException - the maximum time elapsed without change of the reference
public final V tryAwaitGet(V expected)
throws InterruptedException
This method serves to avoid a wait if the reference is not what it was expected to be.
expected - the expected value of the reference
InterruptedException - the waiting task was interrupted
public final V tryAwaitGet(V expected,
long timeout,
TimeUnit unit)
throws InterruptedException,
TimeoutException
This method serves to avoid a wait if the reference is not what it was expected to be.
expected - the expected value of the referencetimeout - the maximum time to waitunit - the time unit of the timeout parameter
InterruptedException - the waiting task was interrupted
TimeoutException - the maximum time elapsed without change of the reference
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||