We've been asked to instantiate Producer and Consumer Queues in Java. The producer "produces" string objects and puts them in the queue and the consumer "consumes", or prints out the string objects within the queue. The entire program uses 4 files:
-Queue.java creates a new Queue with methods getObject and putObject
-QueueConsumer.java creates the consumer queue
-QueueProducer.java creates the producer queue
-QueueMain.java drives everything, creating the consumer and producer threads and starts them up
We need to do 2 runs of the program: one in which the queue size is 10 and one in which the queue size is 200. Describe and explain the output that you see in each case.
The output is pretty much the same. The first will print out 10 strings while the second will print out 200 strings. It's just what goes on inside the queue that is different, but that isn't visibly demonstrated in the output of the program.
-Queue.java creates a new Queue with methods getObject and putObject
-QueueConsumer.java creates the consumer queue
-QueueProducer.java creates the producer queue
-QueueMain.java drives everything, creating the consumer and producer threads and starts them up
We need to do 2 runs of the program: one in which the queue size is 10 and one in which the queue size is 200. Describe and explain the output that you see in each case.
The output is pretty much the same. The first will print out 10 strings while the second will print out 200 strings. It's just what goes on inside the queue that is different, but that isn't visibly demonstrated in the output of the program.