return;
}
NumberFormat decimalFormat = NumberFormat.getNumberInstance();
decimalFormat.setGroupingUsed(true);
Statistics statistics = session.getSessionFactory().getStatistics();
Runtime runtime = Runtime.getRuntime();
Collectors collectors = new Collectors(Arrays.asList(new HibernateStatisticsCollector(statistics), new RuntimeStatisticsCollector(runtime)));
collectStatistics(collectors);
C3P0PooledDataSource c3p0PooledDataSource = new C3P0PooledDataSource();
result.include("maxPoolSize", c3p0PooledDataSource.getMaxPoolSize());
result.include("initPoolSize", c3p0PooledDataSource.getInitialPoolSize());
result.include("minPoolSize", c3p0PooledDataSource.getMinPoolSize());
String[] queries = statistics.getQueries();
List<QueryStatsWrapper> queryStatsList = new ArrayList<QueryStatsWrapper>();
for (String query : queries) {
QueryStatistics queryStats = statistics.getQueryStatistics(query);
queryStatsList.add(new QueryStatsWrapper(query, queryStats));
}
result.include("queryStatsList", queryStatsList);
String[] entityNames = statistics.getEntityNames();
Map<String, EntityCacheStatsWrapper> entityCacheStats = new HashMap<String, EntityCacheStatsWrapper>();
for (String entityName : entityNames) {
EntityStatistics entityStatistics = statistics.getEntityStatistics(entityName);
EntityCacheStatsWrapper entityCacheStatsWrapper = new EntityCacheStatsWrapper();
entityCacheStatsWrapper.setEntityStatsWrapper(new EntityStatsWrapper(entityName, entityStatistics));
entityCacheStats.put(entityName, entityCacheStatsWrapper);
}
for (String regionName : statistics.getSecondLevelCacheRegionNames()) {
CacheStatsWrapper cacheStatsWrapper = new CacheStatsWrapper(regionName, statistics.getSecondLevelCacheStatistics(regionName));
if(entityCacheStats.containsKey(regionName)){
EntityCacheStatsWrapper entityCacheStatsWrapper = entityCacheStats.get(regionName);
EntityCacheStatsWrapper entityStatsWrapper = entityCacheStatsWrapper;
entityStatsWrapper.setCacheStatsWrapper(cacheStatsWrapper);
}
else {
EntityCacheStatsWrapper entityCacheStatsWrapper = new EntityCacheStatsWrapper();
entityCacheStatsWrapper.setCacheStatsWrapper(cacheStatsWrapper);
entityCacheStats.put(regionName, entityCacheStatsWrapper);
}
}
result.include("entityCacheStats", entityCacheStats);
List<CollectionStatsWrapper> collectionsStatsList = new ArrayList<CollectionStatsWrapper>();
for (String collectionRoleName : statistics.getCollectionRoleNames()) {
collectionsStatsList.add(new CollectionStatsWrapper(collectionRoleName, statistics));
}
result.include("collectionsStatsList", collectionsStatsList);
List<net.sf.ehcache.Statistics> collectionsCacheStatsList = new ArrayList<net.sf.ehcache.Statistics>();