Copyright © 2001 Qusay H. Mahmoud
19
wait() and notify()
l
Consumer:
l
private List objects = new ArrayList();
l
l
private Object remove() throws InterruptedException {
l
synchronized(objects) {
l
objects.
wait()
;
l
}
l
Object obj = objects.get(0);
l
objects.remove(0);
l
}