You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2015/08/25 09:27:33 UTC
svn commit: r1697585 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
DocumentNodeState.java util/Utils.java
Author: mreutegg
Date: Tue Aug 25 07:27:33 2015
New Revision: 1697585
URL: http://svn.apache.org/r1697585
Log:
OAK-3280: Remove Utils.estimateMemoryUsage(String)
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java?rev=1697585&r1=1697584&r2=1697585&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java Tue Aug 25 07:27:33 2015
@@ -56,7 +56,7 @@ import com.google.common.collect.Iterabl
import com.google.common.collect.Iterators;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.jackrabbit.oak.plugins.document.util.Utils.estimateMemoryUsage;
+import static org.apache.jackrabbit.oak.commons.StringUtils.estimateMemoryUsage;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
/**
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java?rev=1697585&r1=1697584&r2=1697585&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java Tue Aug 25 07:27:33 2015
@@ -41,6 +41,7 @@ import com.mongodb.BasicDBObject;
import org.apache.commons.codec.binary.Hex;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.StringUtils;
import org.apache.jackrabbit.oak.plugins.document.Collection;
import org.apache.jackrabbit.oak.plugins.document.DocumentStore;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
@@ -137,11 +138,11 @@ public class Utils {
if (e.getKey() instanceof Revision) {
size += 32;
} else {
- size += estimateMemoryUsage(e.getKey().toString());
+ size += StringUtils.estimateMemoryUsage(e.getKey().toString());
}
Object o = e.getValue();
if (o instanceof String) {
- size += estimateMemoryUsage((String) o);
+ size += StringUtils.estimateMemoryUsage((String) o);
} else if (o instanceof Long) {
size += 16;
} else if (o instanceof Boolean) {
@@ -172,16 +173,6 @@ public class Utils {
}
/**
- * Estimates the memory usage of the given string.
- *
- * @param s the string to estimate.
- * @return the estimated memory usage.
- */
- public static int estimateMemoryUsage(String s) {
- return 48 + s.length() * 2;
- }
-
- /**
* Generate a unique cluster id, similar to the machine id field in MongoDB ObjectId objects.
*
* @return the unique machine id