}
Thread.sleep(1000);
}
Thread.sleep(2000);
Object obj = new Integer(count);
count++;
//休眠两秒之后再向数组中放入一个内容
synchronized (fifo) {
fifo.add(obj);
print("DATA-IN - did add(), obj=" + obj);
}
Thread.sleep(500);
Integer[] list1 = new Integer[3];
for (int i = 0; i < list1.length; i++) {
list1[i] = new Integer(count);
count++;
}
//向数组之中放入一个数组
synchronized (fifo) {
fifo.addEach(list1);
print("did addEach(), list1.length=" +
list1.length);
}
Integer[] list2 = new Integer[8];
for (int i = 0; i < list2.length; i++) {
list2[i] = new Integer(count);
count++;
}
//向数组之中放入一个数组
synchronized (fifo) {
fifo.addEach(list2);
print("did addEach(), list2.length=" +
list2.length);
}
synchronized (fifo) {
//等待单元为空
fifo.waitUntilEmpty();
//如果为空了,则打印此句
print("fifo.isEmpty()=" + fifo.isEmpty());
}
print("leaving producer()");
}
catch (InterruptedException ix) {