@Override
    public final void doWork() throws Exception {
      try {
        while (ctx.shouldRun() && !stopped) {
          doAnAction();
        }
      } finally {
        workDone();
      }
    }
A test thread that performs a repeating operation.
hbase-server/src/test/java/org/apache/hadoop/hbase/MultithreadedTestUtil.java