You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2017/02/09 15:43:48 UTC

svn commit: r1782349 - /commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java

Author: tv
Date: Thu Feb  9 15:43:47 2017
New Revision: 1782349

URL: http://svn.apache.org/viewvc?rev=1782349&view=rev
Log:
Add a shutdown() method

Modified:
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java?rev=1782349&r1=1782348&r2=1782349&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java Thu Feb  9 15:43:47 2017
@@ -130,6 +130,22 @@ public abstract class JCS
     }
 
     /**
+     * Shut down the cache manager and set the instance to null
+     */
+    public static void shutdown()
+    {
+        synchronized ( JCS.class )
+        {
+            if ( cacheMgr != null && cacheMgr.isInitialized())
+            {
+            	cacheMgr.shutDown();
+            }
+
+            cacheMgr = null;
+        }
+    }
+
+    /**
      * Helper method which checks to make sure the cacheMgr class field is set, and if not requests
      * an instance from CacheManagerFactory.
      *