private void checkThreads(boolean expectThreads) {
    boolean proctorRunning = false;
    boolean watchDogRunning = false;

    for (Thread t : Thread.getAllStackTraces().keySet()) {
      if (t.getName().contains("SystemFailure WatchDog")) {
        watchDogRunning = true;
      } else if (t.getName().contains("SystemFailure Proctor")) {
        proctorRunning = true;
      }
    }
    StringBuilder sb = new StringBuilder(new Date(System.currentTimeMillis()).toString());
    sb.append((watchDogRunning ^ expectThreads) ? " SystemFailure WatchDog, " : " ");
    sb.append((proctorRunning ^ expectThreads) ? "SystemFailure Proctor, " : "");
    sb.append(expectThreads ? "not started." : "still running.");

    if (expectThreads) {
      assertTrue(sb.toString(), proctorRunning && watchDogRunning);
    } else {
      assertTrue(sb.toString(), !proctorRunning && !watchDogRunning);
    }
  }
TRAC #49856: Some GemFire Threads not cleaned up in cache close.
geode-core/src/integrationTest/java/org/apache/geode/internal/SystemFailureThreadCleanupRegressionTest.java