|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectpt.ua.concurrent.CObject
pt.ua.concurrent.Exchanger<T>
public class Exchanger<T>
A simple module support a (generic) exchanger (bidirectional) communication channel between two threads.
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java assert.
| Constructor Summary | |
|---|---|
Exchanger()
Constructs a new Exchanger registering waiting threads. |
|
Exchanger(boolean registerAwaitingThreads)
Constructs a new Exchanger. |
|
| Method Summary | |
|---|---|
T |
exchange(T obj)
Make the argument of a thread the result of the other (exchange values between two threads). |
| Methods inherited from class pt.ua.concurrent.CObject |
|---|
await, await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Exchanger()
public Exchanger(boolean registerAwaitingThreads)
registerAwaitingThreads - if true, threads are registered when waiting| Method Detail |
|---|
public T exchange(T obj)
throws ThreadInterruptedException
obj - reference to the object to be exchanged (send)
ThreadInterruptedException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||