1 |
class Main { |
2 |
|
3 |
public static void main(String args[]) { |
4 |
Queue q = new Queue(); |
5 |
Producer p = new Producer(q, 1000); |
6 |
Consumer c = new Consumer(q, 2000, -1); |
7 |
Consumer d = new Consumer(q, 500, 12); |
8 |
Consumer e = new Consumer(q, 1000, -1); |
9 |
Consumer f = new Consumer(q, 1500, 22); |
10 |
p.start(); |
11 |
c.start(); |
12 |
d.start(); |
13 |
e.start(); |
14 |
f.start(); |
15 |
try { Thread.sleep(21000); } catch(Exception ee) {} |
16 |
Consumer g = new Consumer(q, 1000, -1); |
17 |
g.start(); |
18 |
Consumer h = new Consumer(q, 1000, -1); |
19 |
h.start(); |
20 |
} |
21 |
|
22 |
} |