BlockingQueue queue = new LinkedBlockingQueue(10);
Producer p = new Producer(queue, out);
Consumer c1 = new Consumer("Consumer 1", queue, out);
Consumer c2 = new Consumer("Consumer 2", queue, out);
Consumer c3 = new Consumer("Consumer 3", queue, out);
Consumer c4 = new Consumer("Consumer 4", queue, out);
p.start(); c1.start(); c2.start(); c3.start(); c4.start();
try {
MILLISECONDS.sleep(100);
} catch (InterruptedException ignored) { }
// Finish up with these threads
p.stop();
c1.stop(); c2.stop(); c3.stop(); c4.stop();