Adding getters.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/98601f6c Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/98601f6c Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/98601f6c Branch: refs/heads/master Commit: 98601f6c29038252e1a13f8466b1448a32e59ebb Parents: 02d362b Author: Aaron McCurry <[email protected]> Authored: Tue Mar 17 09:14:10 2015 -0400 Committer: Aaron McCurry <[email protected]> Committed: Tue Mar 17 09:14:10 2015 -0400 ---------------------------------------------------------------------- .../org/apache/blur/store/blockcache_v2/BaseCache.java | 12 ++++++++++-- .../apache/blur/store/blockcache_v2/PooledCache.java | 4 ++++ .../store/blockcache_v2/SingleCachePoolStrategy.java | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/98601f6c/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java ---------------------------------------------------------------------- diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java index 4d1e844..b532759 100644 --- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java +++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java @@ -118,13 +118,13 @@ public class BaseCache extends Cache implements Closeable { Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, CACHE, ENTRIES), new Gauge<Long>() { @Override public Long value() { - return (long) _cacheMap.size(); + return (long) getEntryCount(); } }); Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, CACHE, SIZE), new Gauge<Long>() { @Override public Long value() { - return _cacheMap.weightedSize(); + return getWeightedSize(); } }); _oldFileDaemonThread = new Thread(new Runnable() { @@ -146,6 +146,14 @@ public class BaseCache extends Cache implements Closeable { _oldFileDaemonThread.start(); } + public int getEntryCount() { + return _cacheMap.size(); + } + + public long getWeightedSize() { + return _cacheMap.weightedSize(); + } + protected void cleanupOldFiles() { LOG.debug("Cleanup old files from cache."); Set<Long> validFileIds = new HashSet<Long>(_fileNameToId.values()); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/98601f6c/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/PooledCache.java ---------------------------------------------------------------------- diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/PooledCache.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/PooledCache.java index 2527332..ef554f3 100644 --- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/PooledCache.java +++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/PooledCache.java @@ -113,4 +113,8 @@ public class PooledCache extends Cache { cache.fileClosedForWriting(directory, fileName, fileId); } + public CachePoolStrategy getCachePoolStrategy() { + return _cachePoolStrategy; + } + } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/98601f6c/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/SingleCachePoolStrategy.java ---------------------------------------------------------------------- diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/SingleCachePoolStrategy.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/SingleCachePoolStrategy.java index 7420f63..2f96858 100644 --- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/SingleCachePoolStrategy.java +++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/SingleCachePoolStrategy.java @@ -42,4 +42,8 @@ public class SingleCachePoolStrategy extends CachePoolStrategy { return Arrays.asList(_cache); } + public Cache getCache() { + return _cache; + } + }
