commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1593343 - in /commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache: JCSCache.java JCSCachingManager.java
Date Thu, 08 May 2014 17:32:13 GMT
Author: rmannibucau
Date: Thu May  8 17:32:13 2014
New Revision: 1593343

URL: http://svn.apache.org/r1593343
Log:
better close impl of JCache

Modified:
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCachingManager.java

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java?rev=1593343&r1=1593342&r2=1593343&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java
Thu May  8 17:32:13 2014
@@ -66,7 +66,7 @@ import static org.apache.commons.jcs.jca
 public class JCSCache<K extends Serializable, V extends Serializable, C extends CompleteConfiguration<K,
V>> implements Cache<K, V>
 {
     private final ConcurrentMap<JCSKey<K>, JCSElement<V>> delegate;
-    private final CacheManager manager;
+    private final JCSCachingManager manager;
     private final JCSConfiguration<K, V> config;
     private final CacheLoader<K, V> loader;
     private final CacheWriter<? super K, ? super V> writer;
@@ -82,7 +82,7 @@ public class JCSCache<K extends Serializ
     private final ExecutorService pool;
 
 
-    public JCSCache(final ClassLoader classLoader, final CacheManager mgr,
+    public JCSCache(final ClassLoader classLoader, final JCSCachingManager mgr,
                     final String cacheName,
                     final JCSConfiguration<K, V> configuration,
                     final Properties properties)
@@ -828,9 +828,9 @@ public class JCSCache<K extends Serializ
             return;
         }
 
-        manager.destroyCache(getName());
+        manager.release(getName());
         closed = true;
-        delegate.clear();
+        pool.shutdownNow();
         close(loader);
         close(writer);
         close(expiryPolicy);
@@ -839,9 +839,9 @@ public class JCSCache<K extends Serializ
             close(listener);
         }
         listeners.clear();
-        pool.shutdownNow();
         JMXs.unregister(cacheConfigObjectName);
         JMXs.unregister(cacheStatsObjectName);
+        delegate.clear();
     }
 
     private static void close(final Object potentiallyCloseable)

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCachingManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCachingManager.java?rev=1593343&r1=1593342&r2=1593343&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCachingManager.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCachingManager.java
Thu May  8 17:32:13 2014
@@ -288,4 +288,8 @@ public class JCSCachingManager implement
     {
         return configProperties;
     }
+
+    public void release(final String name) {
+        caches.remove(name);
+    }
 }



Mime
View raw message