jmcnally    2002/07/26 23:07:12

  Modified:    src/java/org/apache/jcs/engine/memory/lru
                        LRUMemoryCache.java
  Log:
  first will never equal old, even if the updated element replaced
  a currently cached element.  This results in a memory leak.
  
  also uncommented some code related to invalidating a group, there is more
  commits to come on that.
  
  Revision  Changes    Path
  1.17      +4 -8      
jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java
  
  Index: LRUMemoryCache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- LRUMemoryCache.java       18 Jun 2002 18:56:39 -0000      1.16
  +++ LRUMemoryCache.java       27 Jul 2002 06:07:12 -0000      1.17
  @@ -76,13 +76,12 @@
   
           // If the node was the same as an existing node, remove it.
   
  -        if ( first.equals( old ) )
  +        if ( old != null && first.ce.getKey().equals( old.ce.getKey() ) )
           {
               removeNode( old );
           }
   
           int size = map.size();
  -
           // If the element limit is reached, we need to spool
   
           if ( size < this.cattr.getMaxObjects() )
  @@ -178,9 +177,9 @@
           {
               log.debug( "getting item for key: " + key );
           }
  -        
  -        MemoryElementDescriptor me = (MemoryElementDescriptor) map.get(key);
   
  +        MemoryElementDescriptor me = (MemoryElementDescriptor)map.get(key);
  +        
           if ( me != null )
           {
               if ( log.isDebugEnabled() )
  @@ -246,7 +245,6 @@
                   }
               }
           }
  -        /*
           else if ( key instanceof GroupId )
           {
               // remove all keys of the same name hierarchy.
  @@ -270,7 +268,6 @@
                   }
               }
           }
  -        */
           else
           {
               // remove single item.
  @@ -373,7 +370,6 @@
               return map.keySet().toArray();
           }
       }
  -
   
       // --------------------------- internal mehods (linked list implementation)
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to