package message;

/**
 * Created by q on 1/7/14.
 */

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class Queue {

    public static void main(String[] args) {
        final int COUNT = 50;
        final int SECONDS_TIMEOUT = 3;

        BlockingQueue<Message> queue = new ArrayBlockingQueue<>(COUNT * 2);
        Generator generator = new Generator(queue, COUNT);
        Reader consumer = new Reader(queue, SECONDS_TIMEOUT);
        new Thread(generator).start();
        new Thread(consumer).start();
        generator = new Generator(queue, COUNT);
        new Thread(generator).start();
    }

}

@@ -237,11 +237,10 @@
  = 5
-0
 ;%0A
+
     
@@ -363,30 +363,19 @@
     
-Generator generator = 
+new Thread(
 new 
@@ -389,32 +389,41 @@
 or(queue, COUNT)
+).start()
 ;%0A        Reader
@@ -420,26 +420,19 @@
     
-Reader consumer = 
+new Thread(
 new 
@@ -465,164 +465,65 @@
 OUT)
-;%0A        new Thread(generator).start();%0A        new Thread(consumer).start();%0A        generator = new Generator(queue, COUNT);%0A        new Thread(generator
+).start();%0A        new Thread(new Generator(queue, COUNT)
 ).st

terse form