Exchanger
Class Exchanger<V>
- java.lang.Object
-
- java.util.concurrent.Exchanger<V>
- Type Parameters:
-
V
- The type of objects that may be exchanged
public class Exchanger<V> extends Object
A synchronization point at which threads can pair and swap elements within pairs. Each thread presents some object on entry to the exchange
method, matches with a partner thread, and receives its partner's object on return. An Exchanger may be viewed as a bidirectional form of a SynchronousQueue
. Exchangers may be useful in applications such as genetic algorithms and pipeline designs.
Sample Usage: