1 import java
.util
.concurrent
.ThreadLocalRandom
;
4 public class Consommateur
implements Runnable
{
6 private BufferCirc buffer
;
8 public Consommateur(BufferCirc b
) {
12 public Consommateur(BufferCirc b
, String name
) {
17 public void setThName(String name
) {
18 Thread
.currentThread().setName(name
);
24 val
= (Integer
)buffer
.preleve();
25 System
.out
.println (Thread
.currentThread().getName() + " a preleve " + val
);
27 Thread
.sleep(ThreadLocalRandom
.current().nextInt(1001));
29 catch (InterruptedException e
) {}
33 } // fin classe Consommateur