From 073c648e12789aefa9d32b7ccf7d2c3a3b268936 Mon Sep 17 00:00:00 2001 From: Peter Carbon Date: Thu, 18 Dec 2008 00:37:37 +0000 Subject: Added cachePercent member variable to support maxMemoryPercent BDB configuration parameter. --- .../repo/sleepycat/BDBRepositoryBuilder.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/main/java/com/amazon') diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java index f60511f..becb437 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java @@ -91,6 +91,7 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder { private double mIndexThrottle = 1.0; private boolean mReadOnly; private Long mCacheSize; + private Integer mCachePercent; private double mLockTimeout = 0.5; private double mTxnTimeout = 300.0; private boolean mTxnNoSync; @@ -436,6 +437,34 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder { return mCacheSize; } + /** + * Set the percent of JVM heap used by the repository cache. Actual + * BDB implementation will select a suitable default if this is not + * set. This is overridden by setting an explicit cacheSize. + */ + public void setCachePercent(int cachePercent) { + mCachePercent = cachePercent; + } + + /** + * Set the percent of JVM heap used by the repository cache. Actual + * BDB implementation will select a suitable default if this is not + * set. This is overridden by setting an explicit cacheSize. + * + * @param cachePercent percent of JVM heap to use, or null for default + */ + public void setCachePercent(Integer cacheSize) { + mCachePercent = cacheSize; + } + + /** + * Returns the percent of JVM heap used by the repository cache, or + * null if default should be selected. + */ + public Integer getCachePercent() { + return mCachePercent; + } + /** * Set the lock timeout, in seconds. Default value is 0.5 seconds. */ -- cgit v1.2.3