Copyright © 2001 Qusay H. Mahmoud
20
wait() and notify()
l
Producer
l
public 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