@Override
    public void run() {
      done = false;
      while (!done) {
        synchronized (this) {
          try {
            wait();
          } catch (InterruptedException ignored) {
            if (done) {
              break;
            }
          }
        }
        try {
          region.flush(true);
        } catch (IOException e) {
          if (!done) {
            LOG.error("Error while flushing cache", e);
            error = e;
          }
          break;
        } catch (Throwable t) {
          LOG.error("Uncaught exception", t);
          throw t;
        }
      }
    }
Flushes the cache in a thread while scanning. The tests verify that the scan is coherent - e.g.
the returned results are always of the same or later update as the previous results. scan /
compact thread join
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java