This is an automated email from the ASF dual-hosted git repository. tv pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
commit bd42161440b98f8485b9dc3b2e79cc1685bb3412 Author: Thomas Vandahl <t...@apache.org> AuthorDate: Tue May 28 15:41:18 2019 +0200 Make all statistic numbers long --- .../apache/commons/jcs/admin/CacheRegionInfo.java | 20 ++++++++++---------- .../org/apache/commons/jcs/admin/JCSAdminBean.java | 12 ++++++------ .../org/apache/commons/jcs/admin/JCSJMXBean.java | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java index 963f5d4..520d38e 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java @@ -41,16 +41,16 @@ public class CacheRegionInfo private final String cacheStatistics; /** The number of memory hits in the cache region */ - private final int hitCountRam; + private final long hitCountRam; /** The number of auxiliary hits in the cache region */ - private final int hitCountAux; + private final long hitCountAux; /** The number of misses in the cache region because the items were not found */ - private final int missCountNotFound; + private final long missCountNotFound; /** The number of misses in the cache region because the items were expired */ - private final int missCountExpired; + private final long missCountExpired; /** The number of bytes counted so far, will be a total of all items */ private final long byteCount; @@ -71,8 +71,8 @@ public class CacheRegionInfo @ConstructorProperties({"cacheName", "cacheSize", "cacheStatus", "cacheStatistics", "hitCountRam", "hitCountAux", "missCountNotFound", "missCountExpired", "byteCount"}) public CacheRegionInfo(String cacheName, int cacheSize, String cacheStatus, - String cacheStatistics, int hitCountRam, int hitCountAux, - int missCountNotFound, int missCountExpired, long byteCount) + String cacheStatistics, long hitCountRam, long hitCountAux, + long missCountNotFound, long missCountExpired, long byteCount) { super(); this.cacheName = cacheName; @@ -123,7 +123,7 @@ public class CacheRegionInfo /** * @return the hitCountRam */ - public int getHitCountRam() + public long getHitCountRam() { return hitCountRam; } @@ -131,7 +131,7 @@ public class CacheRegionInfo /** * @return the hitCountAux */ - public int getHitCountAux() + public long getHitCountAux() { return hitCountAux; } @@ -139,7 +139,7 @@ public class CacheRegionInfo /** * @return the missCountNotFound */ - public int getMissCountNotFound() + public long getMissCountNotFound() { return missCountNotFound; } @@ -147,7 +147,7 @@ public class CacheRegionInfo /** * @return the missCountExpired */ - public int getMissCountExpired() + public long getMissCountExpired() { return missCountExpired; } diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java index e2e8036..8e33621 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java @@ -182,7 +182,7 @@ public class JCSAdminBean implements JCSJMXBean * @return int The size of the region in bytes. */ @Override - public int getByteCount(String cacheName) + public long getByteCount(String cacheName) { return getByteCount(cacheHub.getCache(cacheName)); } @@ -194,7 +194,7 @@ public class JCSAdminBean implements JCSJMXBean * * @return int The size of the region in bytes. */ - public <K, V> int getByteCount(CompositeCache<K, V> cache) + public <K, V> long getByteCount(CompositeCache<K, V> cache) { if (cache == null) { @@ -223,7 +223,7 @@ public class JCSAdminBean implements JCSJMXBean if (ice instanceof CacheElementSerialized) { - size = size + ((CacheElementSerialized<K, V>) ice).getSerializedValue().length; + size += ((CacheElementSerialized<K, V>) ice).getSerializedValue().length; } else { @@ -256,12 +256,12 @@ public class JCSAdminBean implements JCSJMXBean } } - if (size > Integer.MAX_VALUE) + if (size > Long.MAX_VALUE) { - throw new IllegalStateException("The size of cache " + cache.getCacheName() + " (" + size + " bytes) is too large to be represented as an integer."); + throw new IllegalStateException("The size of cache " + cache.getCacheName() + " (" + size + " bytes) is too large to be represented as an long integer."); } - return (int) size; + return size; } /** diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java index 4ad4b7e..1cf02d0 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java @@ -52,9 +52,9 @@ public interface JCSJMXBean * the region or an error occurs, suppresses exceptions and returns 0. * <p> * - * @return int The size of the region in bytes. + * @return long The size of the region in bytes. */ - int getByteCount(String cacheName); + long getByteCount(String cacheName); /** * Clears all regions in the cache.