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:47:58 UTC
svn commit: r929840 - in
/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache: CacheLine.java
UtilCache.java
Author: doogie
Date: Thu Apr 1 04:47:58 2010
New Revision: 929840
URL: http://svn.apache.org/viewvc?rev=929840&view=rev
Log:
Remove CacheLine.getSizeInBytes.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java?rev=929840&r1=929839&r2=929840&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java Thu Apr 1 04:47:58 2010
@@ -20,8 +20,6 @@ package org.ofbiz.base.util.cache;
import java.io.Serializable;
-import org.ofbiz.base.util.UtilObject;
-
public abstract class CacheLine<V> implements Serializable {
public long loadTime;
public final long expireTime;
@@ -39,14 +37,6 @@ public abstract class CacheLine<V> imple
return this.expireTime;
}
- public long getSizeInBytes() {
- try {
- return UtilObject.getByteCount(this);
- } catch (Exception e) {
- return 0;
- }
- }
-
public boolean hasExpired() {
// check this BEFORE checking to see if expireTime <= 0, ie if time expiration is enabled
// check to see if we are using softReference first, slight performance increase
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=929840&r1=929839&r2=929840&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:47:58 2010
@@ -48,6 +48,7 @@ import jdbm.htree.HTree;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.ObjectType;
+import org.ofbiz.base.util.UtilObject;
import org.ofbiz.base.util.UtilValidate;
/**
@@ -395,6 +396,15 @@ public class UtilCache<K, V> implements
}
}
+ private long findSizeInBytes(Object o) {
+ try {
+ return UtilObject.getByteCount(o);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+
public long getSizeInBytes() {
long totalSize = 0;
if (fileTable != null) {
@@ -402,7 +412,7 @@ public class UtilCache<K, V> implements
FastIterator<CacheLine<V>> iter = fileTable.values();
CacheLine<V> value = iter.next();
while (value != null) {
- totalSize += value.getSizeInBytes();
+ totalSize += findSizeInBytes(value);
value = iter.next();
}
} catch (IOException e) {
@@ -411,7 +421,7 @@ public class UtilCache<K, V> implements
}
} else {
for (CacheLine<V> line: memoryTable.values()) {
- totalSize += line.getSizeInBytes();
+ totalSize += findSizeInBytes(line);
}
}
return totalSize;