repositories
/
TD_SR.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Better exception handling.
[TD_SR.git]
/
TD1
/
exo3
/
BufferCirc.java
diff --git
a/TD1/exo3/BufferCirc.java
b/TD1/exo3/BufferCirc.java
index 91c458bc18894aced8aff2ecfd23af8e53847a69..486951502caffd1d4925291dfa37eb1d74372f74 100644
(file)
--- a/
TD1/exo3/BufferCirc.java
+++ b/
TD1/exo3/BufferCirc.java
@@
-33,10
+33,12
@@
public class BufferCirc {
while(isFull()) {
try {
System.out.println("Buffer is full: " + Thread.currentThread().getName()
while(isFull()) {
try {
System.out.println("Buffer is full: " + Thread.currentThread().getName()
- + " is waiting, size: " + nbObj);
+
+ " is waiting, size: " + nbObj);
wait();
}
wait();
}
- catch (InterruptedException e) {}
+ catch (InterruptedException e) {
+ System.out.println("InterruptedException: " + e);
+ }
}
nbObj++;
tampon[prem] = obj;
}
nbObj++;
tampon[prem] = obj;
@@
-50,10
+52,12
@@
public class BufferCirc {
while(isEmpty()) {
try {
System.out.println("Buffer is empty: " + Thread.currentThread().getName()
while(isEmpty()) {
try {
System.out.println("Buffer is empty: " + Thread.currentThread().getName()
- + " is waiting, size: " + nbObj);
+
+ " is waiting, size: " + nbObj);
wait();
}
wait();
}
- catch (InterruptedException e) {}
+ catch (InterruptedException e) {
+ System.out.println("InterruptedException: " + e);
+ }
}
Object outObj = null;
nbObj--;
}
Object outObj = null;
nbObj--;