001package horstmann.ch09_queue2;
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                final int GREETING_COUNT = 100;
011                Runnable run1 = new Producer("Hello, World!",
012                                queue, GREETING_COUNT);
013                Runnable run2 = new Producer("Goodbye, World!",
014                                queue, GREETING_COUNT);
015                Runnable run3 = new Consumer(queue, 2 * GREETING_COUNT);
016
017                Thread thread1 = new Thread(run1);
018                Thread thread2 = new Thread(run2);
019                Thread thread3 = new Thread(run3);
020
021                thread1.start();
022                thread2.start();
023                thread3.start();
024        }
025}
026