01: /**
02:    This program runs two threads in parallel.
03: */
04: public class ThreadTest
05: {
06:    public static void main(String[] args)
07:    {
08:       Queue queue = new Queue(10);
09:       queue.setDebug(true);
10:       final int REPETITIONS = 100;
11:       Runnable run1 = new Producer("Hello, World!", 
12:          queue, REPETITIONS);
13:       Runnable run2 = new Producer("Goodbye, World!", 
14:          queue, REPETITIONS);
15:       Runnable run3 = new Consumer(queue, 2 * REPETITIONS);
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: