correction client
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
public class Au_Woke {
|
||||
private Client[] clients= new Client[30];
|
||||
private Client[] clients= new Client[100];
|
||||
private Restaurant restaurant =new Restaurant();
|
||||
Au_Woke(){
|
||||
restaurant.cuisinier.start();
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Client extends Thread {
|
||||
} catch (InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : a pris une portion de " + compartiment.getName());
|
||||
System.out.println("Client " + Thread.currentThread().getId() + " : a pris une portion de " + compartiment.getName());
|
||||
|
||||
compartiment.servir(r);
|
||||
try{
|
||||
@@ -63,7 +63,7 @@ public class Client extends Thread {
|
||||
|
||||
public void manger(){
|
||||
try{
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : mange");
|
||||
System.out.println("Client " + Thread.currentThread().getId() + " : mange");
|
||||
long temps_manger =new Random().nextInt(2000 - 1000) + 1000;
|
||||
Thread.sleep(temps_manger);
|
||||
}catch(InterruptedException e){
|
||||
@@ -73,7 +73,7 @@ public class Client extends Thread {
|
||||
|
||||
public void sort(){
|
||||
synchronized(restaurant){
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : sortir");
|
||||
System.out.println("Client " + Thread.currentThread().getId() + " : sortir");
|
||||
restaurant.diminuerClient();
|
||||
restaurant.notifyAll();
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class Client extends Thread {
|
||||
while (stand.attendClient()!= this) { //Verify s'il est meme client
|
||||
wait();
|
||||
}
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : fait cuir son plat");
|
||||
System.out.println("Client " + Thread.currentThread().getId() + " : fait cuir son plat");
|
||||
stand.finir_cuit(this);
|
||||
}catch (InterruptedException e){
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
public class Restaurant {
|
||||
protected final int MAX_CLIENTS = 4;
|
||||
protected final int MAX_CLIENTS = 20;
|
||||
|
||||
public int nbClient;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user