code: static ThreadFactory getNamedThreadFactory(final String prefix) {
      SecurityManager s = System.getSecurityManager();
      final ThreadGroup threadGroup = (s != null) ? s.getThreadGroup() :
          Thread.currentThread().getThreadGroup();
  
      return new ThreadFactory() {
        private final AtomicInteger threadNumber = new AtomicInteger(1);
        private final int poolNum = POOLNUMBER.getAndIncrement();
        private final ThreadGroup group = threadGroup;
  
        @Override
        public Thread newThread(Runnable r) {
          final String name =
              prefix + "-pool" + poolNum + "-t" + threadNumber.getAndIncrement();
          return new Thread(group, r, name);
        }
      };
    }
docs: Returns a {@link java.util.concurrent.ThreadFactory} that names each
  created thread uniquely,
  with a common prefix.
  
  @param prefix The prefix of every created Thread's name
  @return a {@link java.util.concurrent.ThreadFactory} that names threads