Author: doogie
Date: Thu Apr 1 04:25:15 2010
New Revision: 929807
URL:
http://svn.apache.org/viewvc?rev=929807&view=revLog:
utilCacheTable is a ConcurrentHashMap, which means the values can be
iterated directly, instead of making a copy.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=929807&r1=929806&r2=929807&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Thu Apr 1 04:25:15 2010
@@ -351,21 +351,9 @@ public class UtilCache<K, V> implements
/** Removes all elements from this cache */
public static void clearAllCaches() {
// We make a copy since clear may take time
- List<UtilCache<?,?>> list = getUtilCacheTableValuesImage();
- for (UtilCache<?,?> cache : list) {
+ for (UtilCache<?,?> cache : utilCacheTable.values()) {
cache.clear();
}
- list.clear();
- }
-
- /**
- * Return an image of the values at a time
- * @return {@link List}
- */
- private static List<UtilCache<?, ?>> getUtilCacheTableValuesImage() {
- List<UtilCache<?, ?>> list = new ArrayList<UtilCache<?, ?>>(utilCacheTable.size());
- list.addAll(utilCacheTable.values());
- return list;
}
public static Set<String> getUtilCacheTableKeySet() {
@@ -604,11 +592,9 @@ public class UtilCache<K, V> implements
/** Clears all expired cache entries from all caches */
public static void clearExpiredFromAllCaches() {
// We make a copy since clear may take time
- List<UtilCache<?,?>> list = getUtilCacheTableValuesImage();
- for (UtilCache<?,?> utilCache : list) {
+ for (UtilCache<?,?> utilCache : utilCacheTable.values()) {
utilCache.clearExpired();
}
- list.clear();
}
/** Checks for a non-expired key in a specific cache */