@Test
  public void testShutdown() throws InterruptedException {
    ex = new ScheduledThreadPoolExecutorWithKeepAlive(50, 1, TimeUnit.SECONDS,
        Executors.defaultThreadFactory(), null);
    ex.schedule(() -> {
      try {
        // change to sleep 3 seconds, the same as testShutdown2, to avoid not enough SLOP time
        Thread.sleep(3000);
        System.out.println("Finished scheduled task");
      } catch (InterruptedException e) {
        fail("interrupted");
      }
    }, 2, TimeUnit.SECONDS);
    long start = System.nanoTime();
    ex.shutdown();
    assertTrue(ex.awaitTermination(10, TimeUnit.SECONDS));
    long elapsed = System.nanoTime() - start;
    assertTrue("Shutdown did not wait for task to complete. Only waited "
        + TimeUnit.NANOSECONDS.toMillis(elapsed), TimeUnit.SECONDS.toNanos(4) < elapsed + SLOP);
  }
time, in nanoseconds, that we should tolerate as slop (evidently needed for windows)
geode-core/src/integrationTest/java/org/apache/geode/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java