title: Polling an Http server (sending http get requests repeatedly) in java
body: <p>My web server sends some information when a REST call is made to it. I would like to constantly poll this server (send HTTP GET requests repeatedly after an interval of ,say, 5 seconds) to check if there are any changes in the information returned.
  What is the most efficient way to do this?
  Can you please provide some code examples?</p>
  
  <p>Please note that I only want to develop the client side code. </p>
  
  <p>I have tried using java's Timer class as follows -</p>
  
  <pre><code>Timer timer = new Timer();
  timer.schedule(new TimerTask() {
      public void run() {
          //send HTTP requests
      }
  }, 0, 3000); 
  </code></pre>
  
  <p>I'm not sure if this is an efficient way.</p>