code: public static Executor newThreadExecutor(final ThreadFactory threadFactory) {
      return new Executor() {
  
        final AtomicInteger id = new AtomicInteger(0);
  
        @Override
        public void execute(Runnable command) {
          Thread t = threadFactory.newThread(command);
          t.start();
        }
      };
    }
docs: Creates an {@link java.util.concurrent.Executor} that always create new thread to execute runnable.
  
  @param threadFactory thread factory for creating new thread.
  @return a new {@link java.util.concurrent.Executor} instance