while(isFull()) {
try {
System.out.println("Buffer is full: " + Thread.currentThread().getName()
- + " is waiting, size: " + nbObj);
+ + " is waiting, size: " + nbObj);
wait();
}
catch (InterruptedException e) {}
while(isEmpty()) {
try {
System.out.println("Buffer is empty: " + Thread.currentThread().getName()
- + " is waiting, size: " + nbObj);
+ + " is waiting, size: " + nbObj);
wait();
}
catch (InterruptedException e) {}