FileDocCategorySizeDatePackage
Producer.javaAPI DocExample539Tue Dec 12 18:57:48 GMT 2000None

Producer

public class Producer extends Thread

Fields Summary
private CubbyHole
cubbyhole
private int
number
Constructors Summary
public Producer(CubbyHole c, int number)

        cubbyhole = c;
        this.number = number;
    
Methods Summary
public voidrun()

        for (int i = 0; i < 10; i++) {
            cubbyhole.put(i);
            System.out.println("Producer #" + this.number
                               + " put: " + i);
            try {
                sleep((int)(Math.random() * 100));
            } catch (InterruptedException e) { }
        }