Copyright © 2001 Qusay H. Mahmoud
20
wait() and notify()
lProducer
lpublic void insert(Object obj) {
l   synchronized(objects) {
l      objects.add(obj);
l      objects.notify();
l   }
l}
l
l- To notify all waiting objects use notifyAll()
l