@@ -0,0 +1,1357 @@
+package ru.job4j.simpleBlockingQueue;%0A%0Apublic class ParallelSearch %7B%0A%0A    public static void main(String%5B%5D args) throws InterruptedException %7B%0A        SimpleBlockingQueue%3CInteger%3E queue = new SimpleBlockingQueue%3CInteger%3E();%0A        final  boolean blockCunsomer = true;%0A%0A        final Thread consumer = new Thread(%0A                () -%3E %7B%0A                    while (true) %7B%0A                        try %7B%0A                            if (!queue.queue.isEmpty()) %7B%0A                                System.out.println(queue.poll());%0A                            %7D else %7B%0A                                Thread.currentThread().interrupt();%0A                            %7D%0A                        %7D catch (Exception e) %7B%0A                            e.printStackTrace();%0A%0A                        %7D%0A                    %7D%0A                %7D%0A        );%0A        consumer.start();%0A        new Thread(%0A                () -%3E %7B%0A                    for (int index = 0; index != 3; index++) %7B%0A                        queue.offer(index);%0A                        System.out.println(queue.queue.peek());%0A                        try %7B%0A                            Thread.sleep(500);%0A                        %7D catch (InterruptedException e) %7B%0A                            e.printStackTrace();%0A                        %7D%0A                    %7D%0A                %7D%0A%0A        ).start();%0A    %7D%0A%7D%0A

task #187593