public static ThreadPoolExecutor newCachedThread(int maximumPoolSize, String pattern, boolean daemon) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(maximumPoolSize, maximumPoolSize,
                60L, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(), createThreadFactory(pattern, daemon));
        threadPoolExecutor.allowCoreThreadTimeOut(true);
        return threadPoolExecutor;
    }
Shuts down an executor service in two phases, first by calling shutdown to reject incoming tasks,
and then calling shutdownNow, if necessary, to cancel any lingering tasks.
After the timeout/on interrupt, the service is forcefully closed.
@param executorService The service to shut down.
@param timeout The timeout of the shutdown.
@param timeUnit The time unit of the shutdown timeout.
clients/src/main/java/org/apache/kafka/common/utils/ThreadUtils.java