FileDocCategorySizeDatePackage
FibonacciProducer.javaAPI DocExample665Sat Apr 17 23:40:46 BST 2004javathreads.examples.ch08.example6

FibonacciProducer

public class FibonacciProducer extends Object implements Runnable

Fields Summary
private Thread
thr
private BlockingQueue
queue
Constructors Summary
public FibonacciProducer(BlockingQueue q)

        queue = q;
        thr = new Thread(this);
        thr.start();
    
Methods Summary
public voidrun()

        try {
            for(int x=0;;x++) {
                Thread.sleep(1000);
                queue.put(new Integer(x));
                System.out.println("Produced request " + x);
            }
        } catch (InterruptedException ex) {
        }