title: Execute Java Timer at every 2 hours
body: <p>I have a timer routine I want to execute every two hours. But my logic below seem to execute too early than expected. Does anyone know what I am doing wrong?</p>
  
  <pre><code>         (new Timer()).scheduleAtFixedRate(new TimerTask()
            {
  
              @Override
              public void run()
              {
  
                try
                {                  
                 //TODO: Perform routine.
                }
                catch (Exception ex)
                {
                  try
                  {
                    throw ex;
                  }
                  catch (Exception e)
                  {
  
                  }
                }
              }
  
            }, 0, (1000 * 60 * 120));
  </code></pre>
  
  <p>Thanks.</p>