JCS-199 Properly shut down auxiliaries
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
index 85712ff..b13b66d 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
@@ -631,6 +631,19 @@
             // do the traditional shutdown of the regions.
             getCacheNames().forEach(this::freeCache);
 
+            // shut down auxiliaries
+            for (String key : auxiliaryCaches.keySet())
+            {
+                try
+                {
+                    freeAuxiliaryCache(key);
+                }
+                catch (IOException e)
+                {
+                    log.warn("Auxiliary cache {0} failed to shut down", key, e);
+                }
+            }
+
             // shut down factories
             auxiliaryFactoryRegistry.values().forEach(AuxiliaryCacheFactory::dispose);
 
@@ -779,6 +792,35 @@
     }
 
     /**
+     * Dispose a cache and remove it from the map of registered auxiliary caches
+     *
+     * @param auxName the auxiliary name
+     * @param cacheName the region name
+     * @throws IOException if disposing of the cache fails
+     */
+    public void freeAuxiliaryCache(String auxName, String cacheName) throws IOException
+    {
+        String key = String.format("aux.%s.region.%s", auxName, cacheName);
+        freeAuxiliaryCache(key);
+    }
+
+    /**
+     * Dispose a cache and remove it from the map of registered auxiliary caches
+     *
+     * @param key the key into the map of auxiliaries
+     * @throws IOException if disposing of the cache fails
+     */
+    public void freeAuxiliaryCache(String key) throws IOException
+    {
+        AuxiliaryCache<?, ?> aux = auxiliaryCaches.remove( key );
+
+        if ( aux != null )
+        {
+            aux.dispose();
+        }
+    }
+
+    /**
      * Gets stats for debugging. This calls gets statistics and then puts all the results in a
      * string. This returns data for all regions.
      * <p>