title: java blockingqueue consumer block on full queue
body: <p>I'm writing an small program to put tweets from the Twitter public stream into an HBase database. The program uses two threads, one to collect the tweets and one to process them.
  The first thread uses twitter4j StatusListener to get the tweets and puts them in an ArrayBlockingQueue with an capacity of 100.
  The second thread takes an status from the queue, filters the needed data and moves them to the database.
  The processing takes more time, than the collecting of the status.</p>
  
  <p>The producer looks like this:</p>
  
  <pre><code>public void onStatus(Status status) {
      try {
          this.queue.put(status);
      } catch(Exception ex) {
          ex.printStackTrace();
      }
  }
  </code></pre>
  
  <p>The consumer uses take and calls an function to process the new status:</p>
  
  <pre><code>public void run() {
      try {
          while(true) {
              // Get new status to process
              this.status = this.queue.take();
              this.analyse();
          }
      } catch(Exception ex) {
          ex.printStackTrace();
      }
   }
  </code></pre>
  
  <p>In the main function the two threads were created and started:</p>
  
  <pre><code>ArrayBlockingQueue&lt;Status&gt; queue_public = new ArrayBlockingQueue&lt;Status&gt;(100);
  
  Thread ta_public = new Thread(new TweetAnalyser(cl.getOptionValue("config"), queue_public));
  Thread st_public = new Thread(new RunPublicStream(cl.getOptionValue("config"), queue_public));
  
  ta_public.start();
  st_public.start();
  </code></pre>
  
  <p>The program runs for awhile without any problem, but then stops suddenly. At this time the queue is full and it seems, that the consumer is not able to take a new status from it. I tried several variations of the producer/consumer pattern without success. No exception is thrown.</p>
  
  <p>I don't know were to look for the failure. I hope someone could give me an hint or an solution.</p>