commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1729184 - in /commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory: AbstractDoubleLinkedListMemoryCache.java lru/LHMLRUMemoryCache.java util/MemoryElementDescriptor.java
Date Mon, 08 Feb 2016 14:45:35 GMT
Author: tv
Date: Mon Feb  8 14:45:34 2016
New Revision: 1729184

URL: http://svn.apache.org/viewvc?rev=1729184&view=rev
Log:
Make sure the SoftReference can actually be garbage collected.

Modified:
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java?rev=1729184&r1=1729183&r2=1729184&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
Mon Feb  8 14:45:34 2016
@@ -32,6 +32,7 @@ import org.apache.commons.jcs.engine.Cac
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
 import org.apache.commons.jcs.engine.control.CompositeCache;
 import org.apache.commons.jcs.engine.control.group.GroupAttrName;
+import org.apache.commons.jcs.engine.memory.util.DefaultMemoryElementDescriptor;
 import org.apache.commons.jcs.engine.memory.util.MemoryElementDescriptor;
 import org.apache.commons.jcs.engine.stats.StatElement;
 import org.apache.commons.jcs.engine.stats.Stats;
@@ -505,7 +506,7 @@ public abstract class AbstractDoubleLink
         lock.lock();
         try
         {
-            MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce);
+            MemoryElementDescriptor<K, V> me = new DefaultMemoryElementDescriptor<K,
V>(ce);
             list.addFirst(me);
             if ( log.isDebugEnabled() )
             {
@@ -532,7 +533,7 @@ public abstract class AbstractDoubleLink
         lock.lock();
         try
         {
-            MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce);
+            MemoryElementDescriptor<K, V> me = new DefaultMemoryElementDescriptor<K,
V>(ce);
             list.addLast(me);
             if ( log.isDebugEnabled() )
             {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java?rev=1729184&r1=1729183&r2=1729184&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
Mon Feb  8 14:45:34 2016
@@ -33,6 +33,7 @@ import org.apache.commons.jcs.engine.beh
 import org.apache.commons.jcs.engine.control.CompositeCache;
 import org.apache.commons.jcs.engine.control.group.GroupAttrName;
 import org.apache.commons.jcs.engine.memory.AbstractMemoryCache;
+import org.apache.commons.jcs.engine.memory.util.DefaultMemoryElementDescriptor;
 import org.apache.commons.jcs.engine.memory.util.MemoryElementDescriptor;
 import org.apache.commons.jcs.engine.stats.StatElement;
 import org.apache.commons.jcs.engine.stats.Stats;
@@ -96,7 +97,7 @@ public class LHMLRUMemoryCache<K, V>
         throws IOException
     {
         putCnt.incrementAndGet();
-        map.put( ce.getKey(), new MemoryElementDescriptor<K, V>(ce) );
+        map.put( ce.getKey(), new DefaultMemoryElementDescriptor<K, V>(ce) );
     }
 
     /**

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java?rev=1729184&r1=1729183&r2=1729184&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java
Mon Feb  8 14:45:34 2016
@@ -25,15 +25,12 @@ import org.apache.commons.jcs.utils.stru
 /**
  * This wrapper is needed for double linked lists.
  */
-public class MemoryElementDescriptor<K, V>
+public abstract class MemoryElementDescriptor<K, V>
     extends DoubleLinkedListNode<ICacheElement<K, V>>
 {
     /** Don't change */
     private static final long serialVersionUID = -1905161209035522460L;
 
-    /** The CacheElement wrapped by this descriptor */
-    private final ICacheElement<K, V> ce;
-
     /**
      * Constructs a usable MemoryElementDescriptor.
      * <p>
@@ -42,14 +39,11 @@ public class MemoryElementDescriptor<K,
     public MemoryElementDescriptor( ICacheElement<K, V> ce )
     {
         super( ce );
-        this.ce = ce;
     }
 
     /**
-     * @return the ce
+     * Return the cache element wrapped by this descriptor
+     * @return the cache element
      */
-    public ICacheElement<K, V> getCacheElement()
-    {
-        return ce;
-    }
+    public abstract ICacheElement<K, V> getCacheElement();
 }



Mime
View raw message