diff --git a/src/helma/util/CacheMap.java b/src/helma/util/CacheMap.java index 10d4b077..7816f9fe 100644 --- a/src/helma/util/CacheMap.java +++ b/src/helma/util/CacheMap.java @@ -231,14 +231,15 @@ public class CacheMap { oldValue = oldTable.get (key); if (oldValue != null) oldTable.remove( key ); - else { - if (newTable.size() >= threshold) { - // Rotate the tables. - if (logger != null) - logger.log ("Rotating Cache tables at "+newTable.size()+"/"+oldTable.size()+" (new/old)"); - oldTable = newTable; - newTable = new HashMap (eachCapacity, loadFactor); - } + // we put a key into newtable that wasn't there before. check if it + // grew beyond the threshold + if (newTable.size() >= threshold) { + // Rotate the tables. + if (logger != null) + logger.log ("Rotating Cache tables at "+newTable.size()+ + "/"+oldTable.size()+" (new/old)"); + oldTable = newTable; + newTable = new HashMap (eachCapacity, loadFactor); } return oldValue; }