while(isFull()) {
try {
System.out.println("Buffer is full: " + Thread.currentThread().getName()
- + " is waiting, size: " + nbObj);
+ + " is waiting, size: " + nbObj);
wait();
}
- catch (InterruptedException e) {}
+ catch (InterruptedException e) {
+ System.err.println("InterruptedException: " + e);
+ }
}
nbObj++;
tampon[prem] = obj;
while(isEmpty()) {
try {
System.out.println("Buffer is empty: " + Thread.currentThread().getName()
- + " is waiting, size: " + nbObj);
+ + " is waiting, size: " + nbObj);
wait();
}
- catch (InterruptedException e) {}
+ catch (InterruptedException e) {
+ System.err.println("InterruptedException: " + e);
+ }
}
Object outObj = null;
nbObj--;