title: implement-your-own blocking queue in java
body: <p>I know this question has been asked and answered many times before, but I just couldn't figure out a trick on the examples found around internet, like <a href="http://tutorials.jenkov.com/java-concurrency/blocking-queues.html" rel="noreferrer">this</a> or <a href="https://codereview.stackexchange.com/questions/7002/java-blocking-queue">that</a> one.</p>
  
  <p>Both of these solutions check for emptiness of the blocking queue's array/queue/linkedlist to <code>notifyAll</code> waiting threads in <code>put()</code> method and vice versa in <code>get()</code> methods. A <a href="https://codereview.stackexchange.com/a/8334">comment</a> in the second link emphasizes this situation and mentions that that's not necessary.</p>
  
  <p>So the question is; It also seems a bit odd to me to check whether the queue is empty | full to notify all waiting threads. Any ideas?</p>
  
  <p>Thanks in advance.</p>