title: Is Thread.sleep() a waste of time for polling in Java?
body: <p>Suppose I have a <code>nametag</code>, which is UI component in GUI program.
  The <code>nametag</code> will constantly change its text based on the data.
  If the user change his/her name data, then he/she will see the change in <code>nametag</code>.</p>
  
  <p>For this task, my code looks like this:</p>
  
  <pre><code>Thread thread = new Thread(new Runnable() {
      @Override
      public void run() {
  
          while (true) {
              String name = data.getName();
              nametag.setText(name);
              try {
                  Thread.sleep(100);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
  
      }
  });
  </code></pre>
  
  <p>Since the reaction time of <code>0.1s</code> seems instant to people, I included <code>Thread.sleep(100)</code> for computer to take a break.</p>
  
  <p>However, I am not sure if that helps the computer in terms of energy usage or something. Is sleep method in this case complete waste of time? No benefit at all?</p>