@Override
  public void run() {
    // Add some jitter.
    int jitter = ThreadLocalRandom.current().nextInt((int) periodMs);
    LOG.info("Sleeping for {} ms to add jitter", jitter);
    Threads.sleep(jitter);

    while (!isStopped()) {
      long start = EnvironmentEdgeManager.currentTime();
      runOneIteration();

      if (isStopped()) return;
      long sleepTime = periodMs - (EnvironmentEdgeManager.currentTime() - start);
      if (sleepTime > 0) {
        LOG.info("Sleeping for {} ms", sleepTime);
        Threads.sleep(sleepTime);
      }
    }
  }
A policy which does stuff every time interval.
hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/policies/PeriodicPolicy.java