Code example for Exchanger

0
	/** 
	 * @param args 
	 */ 
	public static void main(String[] args) {
		ExecutorService executor = Executors.newFixedThreadPool(2);
		Exchanger<String> exchanger = new Exchanger<String>();
		executor.submit(new ExchangerShowcase("A", exchanger));
		executor.submit(new ExchangerShowcase("B", exchanger));
		executor.shutdown();
	} 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java