1 |
tdb |
1.1 |
class Main { |
2 |
|
|
|
3 |
|
|
public static void main(String args[]) { |
4 |
tdb |
1.3 |
Queue q = new Queue(); |
5 |
tdb |
1.2 |
Producer p = new Producer(q, 1000); |
6 |
tdb |
1.3 |
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 |
tdb |
1.1 |
p.start(); |
11 |
|
|
c.start(); |
12 |
tdb |
1.2 |
d.start(); |
13 |
tdb |
1.3 |
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 |
tdb |
1.1 |
} |
21 |
|
|
|
22 |
|
|
} |