title: Thread won't wake up
body: <p>I'm trying to simulate a simple thermostat, using multi-threading. I have a desired temperature value saved on lblDesiredTemp and another label to display current temperature lblCurrentTemp. The problem occur when while there's more than two active thread in system. the threads which are waiting won't wake up!</p>
  
  <p>this is my method:
      <pre><code>'private synchronized void ApplySetting()
      {
          Thread tempetureUpdater = new Thread() 
               {
                  @Override
                  public synchronized void run() 
                  {
                      txtLog.setText(txtLog.getText() + "\n" + this.getName());
                      try 
                      {
                          while(!isDone)
                              this.wait();
                      } 
                      catch (InterruptedException ex) 
                      {
                          txtLog.setText(txtLog.getText() + "\n" + ex.getMessage());
                      }</p>
  
                  int Max = Integer.parseInt(lblDesiredTemp.getText());
                  int Current = Integer.parseInt(lblCurrentTemp.getText());
  
                  txtLog.setText(txtLog.getText() + "\n" + Current +  " to " + Max);
  
                  if(Current &gt; Max)
                  {
                      isDone = false;
  
                      for (int i = Current; i &gt; Max; i--)
                      {
                          lblGasStatus.setText("Off");
                          try 
                          {
                              Thread.sleep(3000);
                              decreaseTemeture();
                          } 
                          catch (InterruptedException ex) 
                          {
                              txtLog.setText(txtLog.getText() + "\n" + ex.getMessage());
                          }
                      }
  
                      txtLog.setText(txtLog.getText() + "\n" + this.getName() + " done!");
                      isDone = true;
                      this.notifyAll();
                  } 
                  else
                  {
                      isDone = false;
  
                      for (int i = Current; i &lt; Max; i++)
                      {
                          lblGasStatus.setText("On");
                          try 
                          {
                              Thread.sleep(3000);
                              increaseTemeture();
                          } 
                          catch (InterruptedException ex) 
                          {
                              txtLog.setText(txtLog.getText() + "\n" + ex.getMessage());
                          }
                      }
  
                      txtLog.setText(txtLog.getText() + "\n" + this.getName() + " done!");
                      isDone = true;
                      this.notifyAll();
                  }
                  // Report the result using invokeLater().
                  SwingUtilities.invokeLater(new Runnable()   
                  {
                      @Override
                      public void run() 
                      {
                          setEnabled(true);
                      }
                  });
              }
           };
           tempetureUpdater.start();
  }
  </code></pre>
  
  <p>What's the problem?!</p>