svn commit: r929819 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java

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

svn commit: r929819 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java

doogie-3
Author: doogie
Date: Thu Apr  1 04:34:49 2010
New Revision: 929819

URL: http://svn.apache.org/viewvc?rev=929819&view=rev
Log:
Create the memoryTable during the constructor, instead of calling
setLru.  This removes a null check in the latter method.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java?rev=929819&r1=929818&r2=929819&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java Thu Apr  1 04:34:49 2010
@@ -87,7 +87,11 @@ public class CacheLineTable<K, V> implem
                 }
             }
         }
-        this.setLru(maxInMemory);
+        if (maxInMemory > 0) {
+            this.memoryTable = Collections.synchronizedMap(new LRUMap<Object, CacheLine<V>>(maxInMemory));
+        } else {
+            this.memoryTable = FastMap.newInstance();
+        }
     }
 
     private Object fromKey(Object key) {
@@ -294,9 +298,7 @@ public class CacheLineTable<K, V> implem
             this.memoryTable = FastMap.newInstance();
         }
 
-        if (oldmap != null) {
-            this.memoryTable.putAll(oldmap);
-        }
+        this.memoryTable.putAll(oldmap);
     }
 
     public synchronized K getKeyFromMemory(int index) {