org.hibernate.stat.CollectionStatistics Java Examples
The following examples show how to use
org.hibernate.stat.CollectionStatistics.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HibernateStatsReporter.java From keycloak with Apache License 2.0 | 6 votes |
protected void logCollections(StringBuilder builder, String lineSep, Statistics stats) { builder.append("Important collections statistics: ").append(lineSep); for (String col : stats.getCollectionRoleNames()) { CollectionStatistics collectionStats = stats.getCollectionStatistics(col); if (collectionStats.getRecreateCount() > LIMIT || collectionStats.getUpdateCount() > LIMIT || collectionStats.getRemoveCount() > LIMIT || collectionStats.getLoadCount() > LIMIT || collectionStats.getFetchCount() > LIMIT) { builder.append(col).append(" - ") .append("recreated: ").append(collectionStats.getRecreateCount()) .append(", updated: ").append(collectionStats.getUpdateCount()) .append(", removed: ").append(collectionStats.getRemoveCount()) .append(", loaded: ").append(collectionStats.getLoadCount()) .append(", fetched: ").append(collectionStats.getFetchCount()) .append(lineSep); } } builder.append(lineSep); }
Example #2
Source File: StatisticsService.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * @see StatisticsServiceMBean#getCollectionStatistics(java.lang.String) */ public CollectionStatistics getCollectionStatistics(String role) { return stats.getCollectionStatistics(role); }
Example #3
Source File: HibernateStatsUtils.java From pnc with Apache License 2.0 | 4 votes |
/** * Get all the Hibernate collections statistics aggregated in a sorted Map * * @param statistics * @return a sorted map containing all the Hibernate collections statistics */ public static SortedMap<String, Map<String, HibernateMetric>> getSecondLevelCacheCollectionsStats( Statistics statistics) { SortedMap<String, Map<String, HibernateMetric>> collectionsStatMap = new TreeMap<String, Map<String, HibernateMetric>>(); if (statistics.isStatisticsEnabled()) { String[] collectionRoleNames = statistics.getCollectionRoleNames(); Stream.of(collectionRoleNames).forEach(crN -> { CollectionStatistics cStats = statistics.getCollectionStatistics(crN); SortedMap<String, HibernateMetric> cStatMap = new TreeMap<String, HibernateMetric>(); // Collection cache stats cStatMap.put( "cache.region.name", createHibernateMetricItem( "cacheRegionName", "The name of the region where this data is cached.", cStats.getCacheRegionName())); cStatMap.put( "cache.hit.count", createHibernateMetricItem( "cacheHitCount", "The number of successful cache look-ups for this data from its configured cache region since the last Statistics clearing.", cStats.getCacheHitCount())); cStatMap.put( "cache.miss.count", createHibernateMetricItem( "cacheMissCount", "The number of unsuccessful cache look-ups for this data from its configured cache region since the last Statistics clearing.", cStats.getCacheMissCount())); double secondLvlCacheHitsRatio = (cStats.getCacheHitCount() + cStats.getCacheMissCount()) != 0 ? ((double) cStats.getCacheHitCount() / (cStats.getCacheHitCount() + cStats.getCacheMissCount()) * 100) : -1; cStatMap.put( "cache.hit.ratio", createHibernateMetricItem( "cacheHitRatio", "The ratio of successful cache look-ups for this data from its configured cache region since the last Statistics clearing.", df2.format(secondLvlCacheHitsRatio))); cStatMap.put( "cache.put.count", createHibernateMetricItem( "cachePutCount", "The number of times this data has been into its configured cache region since the last Statistics clearing.", cStats.getCachePutCount())); // Collection stats cStatMap.put( "fetch.count", createHibernateMetricItem( "fetchCount", "Number of times (since last Statistics clearing) this collection has been fetched.", cStats.getFetchCount())); cStatMap.put( "recreate.count", createHibernateMetricItem( "recreateCount", "Number of times (since last Statistics clearing) this collection has been recreated (rows potentially deleted and then rows (re-)inserted).", cStats.getRecreateCount())); cStatMap.put( "remove.count", createHibernateMetricItem( "removeCount", "Number of times (since last Statistics clearing) this collection has been removed.", cStats.getRemoveCount())); cStatMap.put( "load.count", createHibernateMetricItem( "loadCount", "Number of times (since last Statistics clearing) this collection has been loaded.", cStats.getLoadCount())); cStatMap.put( "update.count", createHibernateMetricItem( "updateCount", "Number of times (since last Statistics clearing) this collection has been updated.", cStats.getUpdateCount())); collectionsStatMap.put(COLLECTION_STATS_PREFIX + crN, cStatMap); }); } return collectionsStatMap; }
Example #4
Source File: StatisticsWrapper.java From lemon with Apache License 2.0 | 4 votes |
public CollectionStatistics getCollectionStatistics(String role) { return null; }