FileDocCategorySizeDatePackage
Consumer.javaAPI DocExample560Wed Feb 18 01:44:22 GMT 1998None

Consumer

public class Consumer extends Thread

Fields Summary
Producer
producer
Constructors Summary
Consumer(Producer p)

		producer = p;
    
Methods Summary
public static voidmain(java.lang.String[] args)

        final Producer producer = new Producer();
		producer.start();
        new Consumer( producer ).start();
        new Consumer( producer ).start();
    
public voidrun()

		try {
			while ( true ) {
				String message = producer.getMessage();
				System.out.println("Got message: " + message);
				sleep( 2000 );
			}
		} catch( InterruptedException e ) { }