maj constructeur restaurant
This commit is contained in:
@@ -8,6 +8,17 @@ public class Client extends Thread {
|
|||||||
this.restaurant=restaurant;
|
this.restaurant=restaurant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void run(){
|
||||||
|
while(!this.restaurant.libre()){
|
||||||
|
try {
|
||||||
|
wait();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Mi piace tagliare gli spaghetti ! Mi piace la pizza all'ananas ! \n" + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void prendre_portion(Compartiment compartiment){
|
public void prendre_portion(Compartiment compartiment){
|
||||||
synchronized(compartiment){
|
synchronized(compartiment){
|
||||||
int r =new Random().nextInt(MAX_PORTION);
|
int r =new Random().nextInt(MAX_PORTION);
|
||||||
|
|||||||
Reference in New Issue
Block a user