commit | 55cd95f277b1a6f5f50d0dbf064beeb092fc6019 | [log] [tgz] |
---|---|---|
author | Thomas Vandahl <tv@apache.org> | Thu Feb 09 15:43:47 2017 +0000 |
committer | Thomas Vandahl <tv@apache.org> | Thu Feb 09 15:43:47 2017 +0000 |
tree | cbc02b041444e20ace948ce251983eea9799d3e5 | |
parent | 3ac59a1df27a7c34cfda89f6a84b8ceb6f430fd4 [diff] |
Add a shutdown() method git-svn-id: https://svn.apache.org/repos/asf/commons/proper/jcs/trunk@1782349 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java index 304df37..a51da23 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
@@ -130,6 +130,22 @@ } /** + * 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. *