@Override protected TimeStats initialValue() { return new TimeStats(); } };
/** * Miss and obtain elapsed nanoseconds since last miss * * @param key * timer key * @return elapsed nanoseconds since last miss */ public long missAndGet(String key) { TimeStats timeStats = EVENT_MAP.get(key); if (timeStats == null) { timeStats = EVENT_MAP.putIfAbsent(key, new TimeStats()); timeStats = timeStats == null ? EVENT_MAP.get(key) : timeStats; } return timeStats.miss(); }
/** * Hit and obtain elapsed nanoseconds since last hit * * @param key * timer key * @return elapsed nanoseconds since last hit */ public long hitAndGet(String key) { TimeStats timeStats = EVENT_MAP.get(key); if (timeStats == null) { timeStats = EVENT_MAP.putIfAbsent(key, new TimeStats()); timeStats = timeStats == null ? EVENT_MAP.get(key) : timeStats; } return timeStats.hit(); }
/** * Miss and obtain miss count * * @param key * timer key * @return miss count */ public long missAndGetCount(String key) { TimeStats timeStats = EVENT_MAP.get(key); if (timeStats == null) { timeStats = EVENT_MAP.putIfAbsent(key, new TimeStats()); timeStats = timeStats == null ? EVENT_MAP.get(key) : timeStats; } timeStats.miss(); return timeStats.getMissCount(); }
/** * Hit and obtain hit count * * @param key * timer key * @return hit count */ public long hitAndGetCount(String key) { TimeStats timeStats = EVENT_MAP.get(key); if (timeStats == null) { timeStats = EVENT_MAP.putIfAbsent(key, new TimeStats()); timeStats = timeStats == null ? EVENT_MAP.get(key) : timeStats; } timeStats.hit(); return timeStats.getHitCount(); }