@@ -0,0 +1,955 @@
+package ru.job4j.wait;%0A%0Aimport net.jcip.annotations.GuardedBy;%0Aimport net.jcip.annotations.ThreadSafe;%0A%0Aimport java.util.LinkedList;%0Aimport java.util.Queue;%0A%0A/**%0A * Class %3CName class%3E.%0A *%0A * @author Alexey Rastorguev (rastorguev00@gmail.com)%0A * @version 0.1%0A * @since 08.02.2018%0A */%0A@ThreadSafe%0Apublic class SimpleBlockingQueue%3CT%3E %7B%0A    @GuardedBy(%22this%22)%0A    private Queue%3CT%3E queue = new LinkedList%3C%3E();%0A    @GuardedBy(%22this%22)%0A    private int size = 10;%0A    @GuardedBy(%22this%22)%0A    private int pozition = 0;%0A%0A    public void offer(T value) throws InterruptedException %7B%0A        synchronized (queue) %7B%0A            if (pozition %3E= size) %7B%0A                this.wait();%0A            %7D%0A            queue.offer(value);%0A        %7D%0A    %7D%0A%0A    public T peek() throws InterruptedException %7B%0A        synchronized (queue) %7B%0A            if (queue.isEmpty()) %7B%0A                this.wait();%0A            %7D%0A        %7D%0A        pozition--;%0A        return queue.poll();%0A    %7D%0A%7D%0A

add pattern Producer Consumer [task #1098]