public class Exchanger<T> extends CObject
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
Exchanger()
Constructs a new Exchanger registering waiting threads.
|
Exchanger(boolean registerAwaitingThreads)
Constructs a new Exchanger.
|
Modifier and Type | Method and Description |
---|---|
T |
exchange(T obj)
Make the argument of a thread the result of the other (exchange values between two threads).
|
await, await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
public Exchanger()
public Exchanger(boolean registerAwaitingThreads)
registerAwaitingThreads
- if true, threads are registered when waitingpublic T exchange(T obj) throws ThreadInterruptedException
obj
- reference to the object to be exchanged (send)ThreadInterruptedException