code: public void run() {
      while (keep_running) {
        try {
          // tell controller to do some real work for a change
          controller.process();
  
          // waiting check_interval ms, while taking sleep_interval ms
          // long naps so we can break off faster if the server is shut
          // down
          long wait_start = System.currentTimeMillis();
          do {
            Thread.sleep(sleep_interval);
          } while (keep_running &&
                   (System.currentTimeMillis() - wait_start) < check_interval);
  
        } catch (Throwable e) {
          controller.reportError(e);
          try {
            Thread.sleep(getErrorWaitInteral()); // wait a good while, then retry
          } catch (InterruptedException e2) {
          }
        }
      }
      controller.reportStopped();
    }
docs: --- Runnable implementation