Author: doogie
Date: Thu Oct 8 20:49:17 2009
New Revision: 823319
URL:
http://svn.apache.org/viewvc?rev=823319&view=revLog:
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);
}
}