@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics( getEntityManagerFactory( args ) ); return Long.valueOf( statistics != null ? statistics.getSecondLevelCacheMissCount() : 0 ); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
json.put("ConnectCount", statistics.getConnectCount()); json.put("SecondLevelCacheHitCount", statistics.getSecondLevelCacheHitCount()); json.put("SecondLevelCacheMissCount", statistics.getSecondLevelCacheMissCount()); json.put("SecondLevelCachePutCount", statistics.getSecondLevelCachePutCount()); json.put("SessionCloseCount", statistics.getSessionCloseCount());
@Override public double getValue(Statistics statistics) { return statistics.getSecondLevelCacheMissCount(); } }
assertEquals(0L, statistics.getSecondLevelCacheMissCount()); assertEquals(0L, statistics.getSecondLevelCachePutCount()); assertFalse(sessionFactory.getCache().containsEntity(PurchaseOrder.class, 1L)); assertEquals(0, statistics.getSecondLevelCacheMissCount()); assertEquals(0, statistics.getSecondLevelCachePutCount()); assertEquals( 1, statistics.getSecondLevelCacheMissCount() ); assertEquals( 0, statistics.getSecondLevelCachePutCount() );
/** * @see StatisticsServiceMBean#getSecondLevelCacheMissCount() */ public long getSecondLevelCacheMissCount() { return stats.getSecondLevelCacheMissCount(); } /**
/** * @see StatisticsServiceMBean#getSecondLevelCacheMissCount() */ public long getSecondLevelCacheMissCount() { return stats.getSecondLevelCacheMissCount(); } /**
/** * @see StatisticsServiceMBean#getSecondLevelCacheMissCount() */ public long getSecondLevelCacheMissCount() { return stats.getSecondLevelCacheMissCount(); } /**
/** * @see StatisticsServiceMBean#getSecondLevelCacheMissCount() */ public long getSecondLevelCacheMissCount() { return stats.getSecondLevelCacheMissCount(); } /**
@Override void handle(final ModelNode response, final String name, ManagementLookup stats, OperationContext context) { response.set(stats.getStatistics().getSecondLevelCacheMissCount()); } });
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args)); return Long.valueOf(statistics != null ? statistics.getSecondLevelCacheMissCount() : 0); } };
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()); } }
private void addEntityCheckCache(SessionFactoryImplementor sessionFactory) throws Exception { Item item = new Item( "chris", "Chris's Item" ); withTxSession(s -> s.persist( item )); withTxSession(s -> { Item found = s.load(Item.class, item.getId()); Statistics stats = sessionFactory.getStatistics(); log.info(stats.toString()); assertEquals(item.getDescription(), found.getDescription()); assertEquals(0, stats.getSecondLevelCacheMissCount()); assertEquals(1, stats.getSecondLevelCacheHitCount()); s.delete(found); }); }