jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject cvs commit: jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/lru LRUMemoryCache.java
Date Thu, 08 Jul 2004 00:48:45 GMT
asmuts      2004/07/07 17:48:45

  Modified:    src/java/org/apache/jcs/engine/memory/lru
                        LRUMemoryCache.java
  Log:
  temp fix for map / linked list out of synch bug
  
  Revision  Changes    Path
  1.25      +9 -4      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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- LRUMemoryCache.java	29 Jun 2004 01:26:22 -0000	1.24
  +++ LRUMemoryCache.java	8 Jul 2004 00:48:45 -0000	1.25
  @@ -77,9 +77,14 @@
       // Asynchronisly create a MemoryElement
   
       ce.getElementAttributes().setLastAccessTimeNow();
  -    addFirst( ce );
  -    MemoryElementDescriptor old =
  -        ( MemoryElementDescriptor ) map.put( first.ce.getKey(), first );
  +    MemoryElementDescriptor old = null;
  +    synchronized ( this )
  +    {
  +      // TODO address double synchronization of addFirst, use write lock
  +      addFirst( ce );
  +      // this must be synchronized
  +      old = ( MemoryElementDescriptor ) map.put( first.ce.getKey(), first );
  +    }
   
       // If the node was the same as an existing node, remove it.
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org


Mime
View raw message