public long getStatisticValue(Object entryKey) { StatisticEntry statisticEntry = entriesMap.get(entryKey); return statisticEntry != null ? statisticEntry.getValue() : 0; }
public StatisticEntry increment(Object statisticEntryKey, long value) { if (statisticEntryKey == null) { throw new IllegalArgumentException("statistic entry key must be specified"); } // Get the StatisticEntry object which contains the actual value. // If it doesn't already exist, create it so that it can be incremented StatisticEntry statisticEntry = entriesMap.get(statisticEntryKey); if (statisticEntry == null) { StatisticEntry newStatisticEntry = new StatisticEntry(statisticEntryKey); statisticEntry = entriesMap.putIfAbsent(statisticEntryKey, newStatisticEntry); if (statisticEntry == null) { statisticEntry = newStatisticEntry; } } // Increment the actual value statisticEntry.increment(value); return statisticEntry; }
public StatisticEntry increment(Object statisticEntryKey, long value) { if (statisticEntryKey == null) { throw new IllegalArgumentException("statistic entry key must be specified"); } // Get the StatisticEntry object which contains the actual value. // If it doesn't already exist, create it so that it can be incremented StatisticEntry statisticEntry = entriesMap.get(statisticEntryKey); if (statisticEntry == null) { StatisticEntry newStatisticEntry = new StatisticEntry(statisticEntryKey); statisticEntry = entriesMap.putIfAbsent(statisticEntryKey, newStatisticEntry); if (statisticEntry == null) { statisticEntry = newStatisticEntry; } } // Increment the actual value statisticEntry.increment(value); return statisticEntry; }
public long getStatisticValue(Object entryKey) { StatisticEntry statisticEntry = entriesMap.get(entryKey); return statisticEntry != null ? statisticEntry.getValue() : 0; }