public class ThreadTester
1: /**
2: This program runs two threads in parallel.
3: */
4: public class ThreadTester
5: {
6: public static void main(String[] args)
7: {
8: BoundedQueue<String> queue = new BoundedQueue<String>(10);
9: final int GREETING_COUNT = 100;
10: Runnable run1 = new Producer("Hello, World!",
11: queue, GREETING_COUNT);
12: Runnable run2 = new Producer("Goodbye, World!",
13: queue, GREETING_COUNT);
14: Runnable run3 = new Consumer(queue, 2 * GREETING_COUNT);
15:
16: Thread thread1 = new Thread(run1);
17: Thread thread2 = new Thread(run2);
18: Thread thread3 = new Thread(run3);
20: thread1.start();
21: thread2.start();
22: thread3.start();
23: }
24: }