title: process a method that does not stop runnable() in java
body: <p>I want to have a method that checks if there's an update in the database every second, if the method found a changes in the database, it will call another method to execute the desired operation. </p>
  
  <p>the problem i am facing is that i want a method that keeps on recurring every second even if it calls another method to execute a block of operation. </p>
  
  <p>how would i done that? </p>
  
  <p>I had already use this code</p>
  
  <pre><code>ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
      Runnable r = new Runnable() {
  
          @Override
          public void run() {
              try {
                  CheckNewRequest();
                  System.out.println("rode road rowd rowed");
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                   JOptionPane.showMessageDialog(null, e.toString(), "Error CheckNewRequest()", JOptionPane.INFORMATION_MESSAGE);
              }
          }
      };
  
      scheduler.scheduleAtFixedRate(r, 0, 1, TimeUnit.SECONDS);
  </code></pre>
  
  <p>where TimeUnit = 1000, but the problem is it does not recur within the specified amount of time that it is supposed to.</p>