public void run() { buffer.init(); ready.release(); for (int i = 0; i < 100; i++) { buffer.put(i); } buffer.finish(); }
public void run() { producer.getReady(); MyBlockingQueue<Integer> buffer = producer.getBuffer(); Integer item = buffer.take(); while (item != null) { System.out.println(this + " fetches " + item + "."); Thread.yield(); item = buffer.take(); } }