@Override
    public void close() throws InterruptedException {
        if (containerMontoringTask != null) containerMontoringTask.cancel(false);
        if (threadMonitoringTask != null) threadMonitoringTask.cancel(false);
        synchronized (monitor) {
            if (scheduler != null) scheduler.shutdownNow();
            deactivatedContainers.clear();
            currentContainer = null;
            currentContainerActivationTime = null;
            if (scheduler != null && !scheduler.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warning("Failed to shutdown container watchdog within 10 seconds");
            }
            scheduler = null;
        }
    }
A watchdog that monitors all deactivated {@link ActiveContainer} instances with the purpose of detecting stale containers.

@author bjorncs
jdisc_core/src/main/java/com/yahoo/jdisc/core/ContainerWatchdog.java