@SuppressWarnings("ResultOfMethodCallIgnored")
    public static boolean tryShutdownExecutorElegantly(ExecutorService executor, Duration timeout) {
        try {
            executor.shutdown();
            executor.awaitTermination(timeout.toMillis(), TimeUnit.MILLISECONDS);
        } catch (InterruptedException ie) {
            // Let it go.
        }
        if (!executor.isTerminated()) {
            shutdownExecutorForcefully(executor, Duration.ZERO, false);
        }
        return executor.isTerminated();
    }
@Test
    void testTryShutdownExecutorElegantlyInterruptedWithForcefulShutdown() {
        MockExecutorService executor = new MockExecutorService(5);
        executor.interruptAfterNumForcefulShutdown(0);
        assertThat(ComponentClosingUtils.tryShutdownExecutorElegantly(executor, Duration.ofDays(1)))
                .isFalse();
        assertThat(executor.forcefullyShutdownCount).isOne();
    }