@@ -0,0 +1,833 @@
+package com.hzh.corejava.concurrent;%0A%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0A%0Apublic class BlockingQueue %7B%0A    private List queue = new LinkedList();%0A    private int limit = 10;%0A%0A    public BlockingQueue(int limit) %7B%0A        this.limit = limit;%0A    %7D%0A%0A    public synchronized void enqueue(Object item)%0A            throws InterruptedException %7B%0A        while (this.queue.size() == this.limit) %7B%0A            wait();%0A        %7D%0A%0A        if (this.queue.size() == 0) %7B%0A            notifyAll();%0A        %7D%0A        this.queue.add(item);%0A    %7D%0A%0A%0A    public synchronized Object dequeue()%0A            throws InterruptedException %7B%0A        while (this.queue.size() == 0) %7B%0A            wait();%0A        %7D%0A%0A        if (this.queue.size() == this.limit) %7B%0A            notifyAll();%0A        %7D%0A%0A        return this.queue.remove(0);%0A    %7D%0A%0A%7D%0A

Add Blocking Queue