title: Java ReentrantLock.unlock/await()/signal() not throwing IllegalMonitorStateException
body: <p>Where am I going wrong? Even though my consumer Thread is not holding the lock, the program is not throwing IllegalMonitorStateException for any of the lock calls (unlock/await/signal).</p>
  
  <p><strong>Update:</strong> </p>
  
  <pre><code>private final ReentrantLock lock = new ReentrantLock();
  private final Condition producers = lock.newCondition();
  private final Condition consumers = lock.newCondition();
  
  @Override
  public void run() {
  
      while (true) {
          try {
              //lock.lockInterruptibly();
              try {
                  while (sharedResource.isEmpty()) {
                      printErr(name + " : Queue Empty ..");
                      consumers.await(500, TimeUnit.MILLISECONDS);
                  }
  
                  String obj = sharedResource.remove(0);
                  printOut(name + " : " + obj);
                  if (obj.equals(POISON_PILL)) {
                      sharedResource.add(POISON_PILL);
                      // System.err.println(name +" Taking break");
                      break;
                  }
  
                  producers.signal();
              } finally {
                  lock.unlock();
              }
              Thread.sleep(100);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
  
          // if(debug)System.err.println("Consumer Looping");
      }
  }
  </code></pre>
  
  <p>void java.util.concurrent.locks.ReentrantLock.unlock()</p>
  
  <p>As per Java <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantLock.html#unlock%28%29" rel="nofollow">Doc</a>. 
  public void unlock()
  Attempts to release this lock.
  If the current thread is the holder of this lock then the hold count is decremented. If the hold count is now zero then the lock is released. <code>If the current thread is not the holder of this lock then IllegalMonitorStateException is thrown</code>.</p>