public static void shutdownExecutor(ExecutorService executorService, long timeout, TimeUnit timeUnit,
        Logger logger) {
        if (null == executorService) {
            return;
        }
        executorService.shutdown();
        try {
            if (!executorService.awaitTermination(timeout, timeUnit)) {
                executorService.shutdownNow();
                logger.error("Executor {} did not terminate in time, forcefully shutting down", executorService);
            }
        } catch (InterruptedException e) {
            executorService.shutdownNow();
            Thread.currentThread().interrupt();
        }
    }
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.
s3stream/src/main/java/com/automq/stream/utils/ThreadUtils.java