@Test
  public void testPrefetchWithDelay() throws Exception {
    // Configure custom delay
    PrefetchExecutorNotifier prefetchExecutorNotifier = new PrefetchExecutorNotifier(conf);
    conf.setInt(PREFETCH_DELAY, 25000);
    conf.setFloat(PREFETCH_DELAY_VARIATION, 0.0f);
    prefetchExecutorNotifier.onConfigurationChange(conf);

    HFileContext context = new HFileContextBuilder().withCompression(Compression.Algorithm.GZ)
      .withBlockSize(DATA_BLOCK_SIZE).build();
    Path storeFile = writeStoreFile("TestPrefetchWithDelay", context);
    long startTime = System.currentTimeMillis();
    HFile.Reader reader = HFile.createReader(fs, storeFile, cacheConf, true, conf);

    // Wait for 20 seconds, no thread should start prefetch
    Thread.sleep(20000);
    assertFalse("Prefetch threads should not be running at this point", reader.prefetchStarted());
    long timeout = 10000;
    Waiter.waitFor(conf, 10000, () -> (reader.prefetchStarted() || reader.prefetchComplete()));

    assertTrue(reader.prefetchStarted() || reader.prefetchComplete());

    assertTrue("Prefetch should start post configured delay",
      getElapsedTime(startTime) > PrefetchExecutor.getPrefetchDelay());

    conf.setInt(PREFETCH_DELAY, 1000);
    conf.setFloat(PREFETCH_DELAY_VARIATION, PREFETCH_DELAY_VARIATION_DEFAULT_VALUE);
    prefetchExecutorNotifier.onConfigurationChange(conf);
  }
Read a storefile in the same manner as a scanner -- using non-positional reads and without
waiting for prefetch to complete.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java