@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics( getEntityManagerFactoryAccess( args ), getPathAddress( args ) ); return Long.valueOf( statistics != null ? statistics.getElementCountInMemory() : 0 ); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override protected void handle(SecondLevelCacheStatistics statistics, OperationContext context, String attributeName) { long count = statistics.getElementCountInMemory(); context.getResult().set(count); } };
public String toString() { StringBuffer buf = new StringBuffer() .append("SecondLevelCacheStatistics") .append("[hitCount=").append(this.hitCount) .append(",missCount=").append(this.missCount) .append(",putCount=").append(this.putCount); //not sure if this would ever be null but wanted to be careful if (this.cache != null) { buf.append(",elementCountInMemory=").append(this.getElementCountInMemory()) .append(",elementCountOnDisk=").append(this.getElementCountOnDisk()) .append(",sizeInMemory=").append(this.getSizeInMemory()); } buf.append(']'); return buf.toString(); } }
public String toString() { StringBuffer buf = new StringBuffer() .append("SecondLevelCacheStatistics") .append("[hitCount=").append(this.hitCount) .append(",missCount=").append(this.missCount) .append(",putCount=").append(this.putCount); //not sure if this would ever be null but wanted to be careful if (this.cache != null) { buf.append(",elementCountInMemory=").append(this.getElementCountInMemory()) .append(",elementCountOnDisk=").append(this.getElementCountOnDisk()) .append(",sizeInMemory=").append(this.getSizeInMemory()); } buf.append(']'); return buf.toString(); } }
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.SecondLevelCacheStatistics statistics = getStatistics(getEntityManagerFactoryAccess(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getElementCountInMemory() : 0); } };
public CacheRegionStats(String region, SecondLevelCacheStatistics src) { this(region); this.hitCount = src.getHitCount(); this.missCount = src.getMissCount(); this.putCount = src.getPutCount(); this.hitRatio = determineHitRatio(); this.elementCountInMemory = src.getElementCountInMemory(); this.elementCountOnDisk = src.getElementCountOnDisk(); this.elementCountTotal = src.getElementCountInMemory() + src.getElementCountOnDisk(); }
public CacheRegionStats(String region, SecondLevelCacheStatistics src) { this(region); this.hitCount = src.getHitCount(); this.missCount = src.getMissCount(); this.putCount = src.getPutCount(); this.hitRatio = determineHitRatio(); this.elementCountInMemory = src.getElementCountInMemory(); this.elementCountOnDisk = src.getElementCountOnDisk(); this.elementCountTotal = /* src.getElementCountInMemory() + */src.getElementCountOnDisk(); }
public CacheRegionStats(String region, SecondLevelCacheStatistics src) { this(region); this.hitCount = src.getHitCount(); this.missCount = src.getMissCount(); this.putCount = src.getPutCount(); this.hitRatio = determineHitRatio(); this.elementCountInMemory = src.getElementCountInMemory(); this.elementCountOnDisk = src.getElementCountOnDisk(); this.elementCountTotal = /* src.getElementCountInMemory() + */src.getElementCountOnDisk(); }
public static String[] getCacheStatistics(final SessionFactory sessionFactory, final String cacheRegion) { if (isNull(sessionFactory)) throw new NullPointerException("Parameter sessionFactory is null"); if (isNull(cacheRegion)) throw new NullPointerException("Parameter cacheRegion is null"); if (cacheRegion.isEmpty()) throw new IllegalArgumentException("Parameter cacheRegion is a empty String"); final Statistics sfstats = sessionFactory.getStatistics(); if (!ArrayUtils.contains(sfstats.getSecondLevelCacheRegionNames(), cacheRegion)) throw new IllegalArgumentException("Cache Region" + cacheRegion + " is not managed by given SessionFactory"); final SecondLevelCacheStatistics stats = sfstats.getSecondLevelCacheStatistics(cacheRegion); final NaturalIdCacheStatistics idstats = sfstats.getNaturalIdCacheStatistics(cacheRegion); return new String[] { "+ 2nd Level Cache Statistics: " + cacheRegion, "+", "+ # Puts: " + stats.getPutCount(), "+ # Hits: " + stats.getHitCount(), "+ # Misses: " + stats.getMissCount(), "+ Hit Ratio: " + ((double) stats.getHitCount()) / (stats.getHitCount() + stats.getMissCount()), "+ Size in Memory: " + stats.getSizeInMemory(), "+ Elements in Memory: " + stats.getElementCountInMemory(), "+ Elements on Disk: " + stats.getElementCountOnDisk(), "+", "+ ID # Puts: " + idstats.getPutCount(), "+ ID # Hits: " + idstats.getHitCount(), "+ ID # Misses: " + idstats.getMissCount(), "+ ID Hit Ratio: " + ((double) idstats.getHitCount()) / (idstats.getHitCount() + idstats.getMissCount()), "+ ID Size in Memory: " + idstats.getSizeInMemory(), "+ ID Elements in Memory: " + idstats.getElementCountInMemory(), "+ ID Execution Count: " + idstats.getExecutionCount(), "+ ID Avg Execution Time: " + idstats.getExecutionAvgTime() + "ms", "+ ID Max Execution Time: " + idstats.getExecutionMaxTime() + "ms", "+ ID Min Execution Time: " + idstats.getExecutionMinTime() + "ms", "+", "+" }; }
private void addSecondLevelCacheStats(List<ApplicationStat> res, Statistics stats) { addCacheStat(res, "2Cache/total/", stats.getSecondLevelCacheHitCount(), stats.getSecondLevelCacheMissCount(), stats.getSecondLevelCachePutCount()); for (String cacheRegion : stats.getSecondLevelCacheRegionNames()) { SecondLevelCacheStatistics cStats = stats.getSecondLevelCacheStatistics(cacheRegion); addCacheStat(res, "2Cache/" + cacheRegion + "/", cStats.getHitCount(), cStats.getMissCount(), cStats.getPutCount()); addStat(res, "2Cache/" + cacheRegion + "/size", cStats.getElementCountInMemory(), "onDisk=" + cStats.getElementCountOnDisk() + ", memSize=" + cStats.getSizeInMemory()); } }
@Override protected List<? extends StatsItem> getStats() { ArrayList<CacheRegionStatsItem> stats = Generics.newArrayList(); String[] regions = sessionFactory.getStatistics().getSecondLevelCacheRegionNames(); for (String region : regions) { CacheRegionStatsItem item = new CacheRegionStatsItem(region); SecondLevelCacheStatistics sl = sessionFactory.getStatistics().getSecondLevelCacheStatistics(region); item.setElementsInMemory(sl.getElementCountInMemory()); item.setElementsOnDisk(sl.getElementCountOnDisk()); item.setHitCount(sl.getHitCount()); item.setMissCount(sl.getMissCount()); item.setPutCount(sl.getPutCount()); item.setKbInMemory(sl.getSizeInMemory() / 1024); stats.add(item); } return stats; }
QueryStatistics queryStats = stats.getQueryStatistics("from Store s"); queryStats.getCacheHitCount(); queryStats.getCacheMissCount(); queryStats.getCachePutCount(); queryStats.getExecutionCount(); queryStats.getExecutionAvgTime(); queryStats.getExecutionMaxTime(); queryStats.getExecutionMinTime(); queryStats.getExecutionRowCount(); SecondLevelCacheStatistics cacheStats = stats.getSecondLevelCacheStatistics("Sale.cache"); cacheStats.getElementCountInMemory(); cacheStats.getElementCountOnDisk(); cacheStats.getEntries(); cacheStats.getHitCount(); cacheStats.getMissCount(); cacheStats.getPutCount(); cacheStats.getSizeInMemory(); CollectionStatistics collectionStats = stats.getCollectionStatistics("Sale.items"); collectionStats.getFetchCount(); collectionStats.getLoadCount(); collectionStats.getRecreateCount(); collectionStats.getRemoveCount(); collectionStats.getUpdateCount();