Hi -

I've been checking out JCS a bit and think I may have found a bug in
AbstractMemoryCache. I assume that a Hashtable is used for the Map
because it is synchronized. When removeAll() is called, however, map is
replaced with a HashMap().

I'm still struggling with thread safety issues in general, but it also
seems to me that removeAll() must have some sort of synchronization to
be thread safe, yes? Or, perhaps JCS is not meant to be thread safe in
general?

A patch follows for the Hashtable to HashMap problem, if it is one.

mike


Index: src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java,v
retrieving revision 1.2
diff -c -r1.2 AbstractMemoryCache.java
*** src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java      27 Jul 2002 
06:39:51 -0000      1.2
--- src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java      19 Nov 2002 
20:22:19 -0000
***************
*** 2,8 ****
  
  import java.io.IOException;
  import java.io.Serializable;
- import java.util.HashMap;
  import java.util.Hashtable;
  import java.util.Iterator;
  import java.util.Map;
--- 2,7 ----
***************
*** 158,164 ****
      public void removeAll()
          throws IOException
      {
!         map = new HashMap();
      }
  
      /**
--- 157,163 ----
      public void removeAll()
          throws IOException
      {
!         map = new Hashtable();
      }
  
      /**

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

Reply via email to