12 |
|
import java.util.Random; |
13 |
|
|
14 |
|
/** |
15 |
< |
* A synchronization point at which two threads can exchange objects. |
16 |
< |
* Each thread presents some object on entry to the {@link #exchange |
17 |
< |
* exchange} method, and receives the object presented by the other |
18 |
< |
* thread on return. |
15 |
> |
* A synchronization point at which threads can pair and swap elements |
16 |
> |
* within pairs. Each thread presents some object on entry to the |
17 |
> |
* {@link #exchange exchange} method, matches with a partner thread, |
18 |
> |
* and receives its partner's object on return. |
19 |
|
* |
20 |
|
* <p><b>Sample Usage:</b> |
21 |
|
* Here are the highlights of a class that uses an <tt>Exchanger</tt> to |