svn commit: r929830 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r929830 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

doogie-3
Author: doogie
Date: Thu Apr  1 04:41:49 2010
New Revision: 929830

URL: http://svn.apache.org/viewvc?rev=929830&view=rev
Log:
Slight tweak to getOrCreateUtilCache, to get better code coverage.

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=929830&r1=929829&r2=929830&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:41:49 2010
@@ -644,12 +644,8 @@ public class UtilCache<K, V> implements
         if (existingCache != null) return existingCache;
         String cacheName = name + getNextDefaultIndex(name);
         UtilCache<K, V> newCache = new UtilCache<K, V>(cacheName, sizeLimit, maxInMemory, expireTime, useSoftReference, useFileSystemStore, name, names);
-        UtilCache<K, V> oldCache = (UtilCache<K, V>) utilCacheTable.putIfAbsent(name, newCache);
-        if (oldCache == null) {
-            return newCache;
-        } else {
-            return oldCache;
-        }
+        utilCacheTable.putIfAbsent(name, newCache);
+        return (UtilCache<K, V>) utilCacheTable.get(name);
     }
 
     public static <K, V> UtilCache<K, V> createUtilCache(String name, int sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, boolean useFileSystemStore, String... names) {