in commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java [842:918]
public synchronized void shutDown()
{
// shutdown element event queue
if (this.elementEventQueue != null)
{
this.elementEventQueue.dispose();
}
// notify any observers
IShutdownObserver observer = null;
while ((observer = shutdownObservers.poll()) != null)
{
observer.shutdown();
}
// Unregister JMX bean
if (isJMXRegistered)
{
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try
{
final ObjectName jmxObjectName = new ObjectName(jmxName);
mbs.unregisterMBean(jmxObjectName);
}
catch (final Exception e)
{
log.warn( "Could not unregister JMX bean.", e );
}
isJMXRegistered = false;
}
// do the traditional shutdown of the regions.
getCacheNames().forEach(this::freeCache);
// shut down auxiliaries
for (final String key : auxiliaryCaches.keySet())
{
try
{
freeAuxiliaryCache(key);
}
catch (final IOException e)
{
log.warn("Auxiliary cache {0} failed to shut down", key, e);
}
}
// shut down factories
auxiliaryFactoryRegistry.values().forEach(AuxiliaryCacheFactory::dispose);
auxiliaryAttributeRegistry.clear();
auxiliaryFactoryRegistry.clear();
// shutdown all scheduled jobs
this.scheduledExecutor.shutdownNow();
// shutdown all thread pools
ThreadPoolManager.dispose();
if (shutdownHook != null)
{
try
{
Runtime.getRuntime().removeShutdownHook(shutdownHook);
}
catch (final IllegalStateException e)
{
// May fail if the JVM is already shutting down
}
this.shutdownHook = null;
}
isConfigured = false;
isInitialized = false;
}