001package horstmann.ch09_queue1;
002/**
003   This program runs two threads in parallel.
004 */
005public class ThreadTester
006{
007        public static void main(String[] args)
008        {
009                BoundedQueue<String> queue = new BoundedQueue<String>(10);
010                queue.setDebug(true);
011                final int GREETING_COUNT = 100;
012                Runnable run1 = new Producer("Hello, World!",
013                                queue, GREETING_COUNT);
014                Runnable run2 = new Producer("Goodbye, World!",
015                                queue, GREETING_COUNT);
016                Runnable run3 = new Consumer(queue, 2 * GREETING_COUNT);
017
018                Thread thread1 = new Thread(run1);
019                Thread thread2 = new Thread(run2);
020                Thread thread3 = new Thread(run3);
021
022                thread1.start();
023                thread2.start();
024                thread3.start();
025        }
026}
027