title: how to implement of semaphore
body: <p>I am going through <a href="http://java.dzone.com/news/java-concurrency-semaphores" rel="nofollow noreferrer">this</a> link , here the implementation of coiunting semaphore is given as :</p>
  <pre><code>public class CountingSemaphore {
    private int signals = 0;
  
    public synchronized void take() {
      this.signals++;
      this.notify();
    }
  
    public synchronized void release() throws InterruptedException{
      while(this.signals == 0) wait();
      this.signals--;
    }
  
  }
  </code></pre>
  <p>i am not able to get that. in the take() method , notify is called which will make other threads to enter the section.Shouldnt there be wait  inside take method. please help me understand.</p>
  <p>Thanks</p>
  <p>Jayendra</p>