01: /**
02:    This program runs two threads in parallel.
03: */
04: public class ThreadTester
05: {
06:    public static void main(String[] args)
07:    {
08:       BoundedQueue<String> queue = new BoundedQueue<String>(10);
09:       queue.setDebug(true);
10:       final int GREETING_COUNT = 100;
11:       Runnable run1 = new Producer("Hello, World!", 
12:             queue, GREETING_COUNT);
13:       Runnable run2 = new Producer("Goodbye, World!", 
14:             queue, GREETING_COUNT);
15:       Runnable run3 = new Consumer(queue, 2 * GREETING_COUNT);
16:       
17:       Thread thread1 = new Thread(run1);
18:       Thread thread2 = new Thread(run2);
19:       Thread thread3 = new Thread(run3);
20: 
21:       thread1.start();
22:       thread2.start();
23:       thread3.start();
24:    }
25: }
26: