protected void shutdownAndAwaitTermination() {
        if ( pool.isShutdown() && periodicHarvest.isCancelled()) {
            // Already had a shutdown notification.
            return;
        }
        periodicHarvest.cancelReaper();
        pool.shutdown(); // Disable new tasks from being submitted
        try {
            // Wait a while for existing tasks to terminate
            if (!pool.awaitTermination(10, TimeUnit.SECONDS)) {
                pool.shutdownNow(); // Cancel currently executing tasks
                // Wait a while for tasks to respond to being cancelled
                if (!pool.awaitTermination(60, TimeUnit.SECONDS)) {
                    log.logDebug("Pool did not terminate");
                }
            }
        } catch (InterruptedException ignored) {
            // (Re-)Cancel if current thread also interrupted
            pool.shutdownNow();
            // Preserve interrupt status
            Thread.currentThread().interrupt();
        }
    }