public static ThreadFactory createThreadFactory(String threadNamePrefix, boolean isDaemon) {
    return new ThreadFactory() {
      private final AtomicInteger threadCount = new AtomicInteger(0);

      @Override
      public Thread newThread(Runnable r) {
        Thread thread = new Thread(r);
        thread.setName(String.format("%s-%d", threadNamePrefix, threadCount.getAndIncrement()));
        thread.setDaemon(isDaemon);
        return thread;
      }
    };
  }
@param threadNamePrefix thread name prefix, the thread name will be "prefix-num"
@param isDaemon if true, the thread be created will be daemon
@return
iotdb-client/session/src/main/java/org/apache/iotdb/session/util/ThreadUtils.java