Code example for ConcurrentLinkedQueue

Methods: add

0
		return value; 
	} 
*/ 
	 
	public static <E> void produce(ConcurrentLinkedQueue<E> queue, E elem){
		queue.add(elem); 
	} 
	public static <E> E consume(ConcurrentLinkedQueue<E> queue){
		E elem ;
		while ((elem = queue.poll()) == null){
			try { 
				Thread.sleep(100); 
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block 
				e.printStackTrace();
			}  
		} 
		return elem;
	} 
}