| Line 36... |
Line 36... |
| 36 |
public static final String STATUS_KEY = "status";
|
36 |
public static final String STATUS_KEY = "status";
|
| 37 |
public static final String AVG_GET_TIME_KEY = "avg_get_time";
|
37 |
public static final String AVG_GET_TIME_KEY = "avg_get_time";
|
| 38 |
public static final String AVG_SEARCH_TIME_KEY = "avg_search_time";
|
38 |
public static final String AVG_SEARCH_TIME_KEY = "avg_search_time";
|
| 39 |
public static final String CACHE_HITS_KEY = "cache_hits";
|
39 |
public static final String CACHE_HITS_KEY = "cache_hits";
|
| 40 |
public static final String CACHE_MISSES_KEY = "cache_misses";
|
40 |
public static final String CACHE_MISSES_KEY = "cache_misses";
|
| - |
|
41 |
public static final String CACHE_HIT_RATIO_KEY = "cache_hit_ratio";
|
| 41 |
public static final String EVICTION_COUNT_KEY = "eviction_count";
|
42 |
public static final String EVICTION_COUNT_KEY = "eviction_count";
|
| 42 |
|
43 |
|
| 43 |
private static Logger log = Logger.getLogger(CacheAdminController.class);
|
44 |
private static Logger log = Logger.getLogger(CacheAdminController.class);
|
| 44 |
|
45 |
|
| 45 |
private List<Map<String, String>> cacheStats;
|
46 |
private List<Map<String, String>> cacheStats;
|
| Line 58... |
Line 59... |
| 58 |
cacheStat.put(OFF_HEAP_STORE_KEY, Long.toString(cache.getOffHeapStoreSize()));
|
59 |
cacheStat.put(OFF_HEAP_STORE_KEY, Long.toString(cache.getOffHeapStoreSize()));
|
| 59 |
cacheStat.put(DISK_STORE_KEY, Integer.toString(cache.getDiskStoreSize()));
|
60 |
cacheStat.put(DISK_STORE_KEY, Integer.toString(cache.getDiskStoreSize()));
|
| 60 |
cacheStat.put(STATUS_KEY, cache.getStatus().toString());
|
61 |
cacheStat.put(STATUS_KEY, cache.getStatus().toString());
|
| 61 |
|
62 |
|
| 62 |
Statistics stat = cache.getStatistics();
|
63 |
Statistics stat = cache.getStatistics();
|
| - |
|
64 |
Long hits = stat.getCacheHits();
|
| - |
|
65 |
Long misses = stat.getCacheMisses();
|
| - |
|
66 |
Double hitratio = 0d;
|
| - |
|
67 |
if (hits > 0) {
|
| - |
|
68 |
hitratio = ((double)hits)/(hits + misses)*100;
|
| - |
|
69 |
}
|
| 63 |
cacheStat.put(AVG_GET_TIME_KEY, Float.toString(stat.getAverageGetTime()));
|
70 |
cacheStat.put(AVG_GET_TIME_KEY, Float.toString(stat.getAverageGetTime()));
|
| 64 |
cacheStat.put(AVG_SEARCH_TIME_KEY, Float.toString(stat.getAverageSearchTime()));
|
71 |
cacheStat.put(AVG_SEARCH_TIME_KEY, Float.toString(stat.getAverageSearchTime()));
|
| 65 |
cacheStat.put(CACHE_HITS_KEY, Long.toString(stat.getCacheHits()));
|
72 |
cacheStat.put(CACHE_HITS_KEY, Long.toString(hits));
|
| 66 |
cacheStat.put(CACHE_MISSES_KEY, Long.toString(stat.getCacheMisses()));
|
73 |
cacheStat.put(CACHE_MISSES_KEY, Long.toString(misses));
|
| - |
|
74 |
cacheStat.put(CACHE_HIT_RATIO_KEY, Long.toString(hitratio.longValue()));
|
| 67 |
cacheStat.put(EVICTION_COUNT_KEY, Long.toString(stat.getEvictionCount()));
|
75 |
cacheStat.put(EVICTION_COUNT_KEY, Long.toString(stat.getEvictionCount()));
|
| 68 |
cacheStat.put(SEARCHES_PER_SEC_KEY, Long.toString(stat.getSearchesPerSecond()));
|
76 |
cacheStat.put(SEARCHES_PER_SEC_KEY, Long.toString(stat.getSearchesPerSecond()));
|
| 69 |
cacheStats.add(cacheStat);
|
77 |
cacheStats.add(cacheStat);
|
| 70 |
log.info(stat);
|
78 |
log.info(stat);
|
| 71 |
}
|
79 |
}
|