You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/10/08 22:49:18 UTC

svn commit: r823319 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java

Author: doogie
Date: Thu Oct  8 20:49:17 2009
New Revision: 823319

URL: http://svn.apache.org/viewvc?rev=823319&view=rev
Log:
Don't use the internal CacheLine value iterator, instead iterating
over the keys, fetching the value, and then removing when it matches.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java?rev=823319&r1=823318&r2=823319&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java Thu Oct  8 20:49:17 2009
@@ -22,7 +22,6 @@
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.cache.UtilCache;
-import org.ofbiz.base.util.cache.CacheLine;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.GenericPK;
 import org.ofbiz.entity.condition.EntityCondition;
@@ -64,13 +63,10 @@
     public void remove(String entityName, EntityCondition condition) {
         UtilCache<GenericPK, GenericValue> entityCache = getCache(entityName);
         if (entityCache == null) return;
-        Iterator<? extends CacheLine<GenericValue>> it = entityCache.getCacheLineValues().iterator();
-        while (it.hasNext()) {
-            CacheLine<GenericValue> line = it.next();
-            if (line.hasExpired()) continue;
-            GenericValue entity = line.getValue();
+        for (GenericPK pk: entityCache.getCacheLineKeys()) {
+            GenericValue entity = entityCache.get(pk);
             if (entity == null) continue;
-            if (condition.entityMatches(entity)) it.remove();
+            if (condition.entityMatches(entity)) entityCache.remove(pk);
         }
     }