@Override
    public Thread newThread(Runnable r) {
      String threadName =
          threadNameFunction.apply(POOL_NUMBER.get(), threadNumber.getAndIncrement());
      Thread t = new Thread(group, r, threadName, 0);
      if (t.isDaemon()) {
        t.setDaemon(false);
      }
      if (t.getPriority() != Thread.NORM_PRIORITY) {
        t.setPriority(Thread.NORM_PRIORITY);
      }
      directThreads.add(new WeakReference<>(t));
      return t;
    }
Modified version of {@code java.util.concurrent.Executors$DefaultThreadFactory} that uses
a {@code Set<WeakReference<Thread>>} to track the {@code Thread}s in the factory's
{@code ThreadGroup} excluding subgroups.
geode-junit/src/main/java/org/apache/geode/test/junit/rules/ExecutorServiceRule.java