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 2010/04/01 06:34:49 UTC

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

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) {