From 204dc4e8f70002da1702ff240ef29ea132acb3d1 Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Thu, 1 Apr 2010 04:34:49 +0000 Subject: [PATCH] Create the memoryTable during the constructor, instead of calling setLru. This removes a null check in the latter method. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@929819 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/base/util/cache/CacheLineTable.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java b/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java index 88e3f08ca1..967ec46162 100644 --- a/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java +++ b/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java @@ -87,7 +87,11 @@ public class CacheLineTable implements Serializable { } } } - this.setLru(maxInMemory); + if (maxInMemory > 0) { + this.memoryTable = Collections.synchronizedMap(new LRUMap>(maxInMemory)); + } else { + this.memoryTable = FastMap.newInstance(); + } } private Object fromKey(Object key) { @@ -294,9 +298,7 @@ public class CacheLineTable implements Serializable { this.memoryTable = FastMap.newInstance(); } - if (oldmap != null) { - this.memoryTable.putAll(oldmap); - } + this.memoryTable.putAll(oldmap); } public synchronized K getKeyFromMemory(int index) {