コード例 #1
0
 @Override
 public int getLong(long key)
     throws NotFoundException, UnavailableException, TimedOutException, TException {
   NonBlockingHashMapLong<Counter> countersMapLong = strategy.getShardingCounter(key);
   Counter result = countersMapLong.get(key);
   return Util.safeResult(result);
 }
コード例 #2
0
 @Override
 public int addLong(long key, int value)
     throws UnavailableException, TimedOutException, TException {
   NonBlockingHashMapLong<Counter> countersMapLong = strategy.getShardingCounter(key);
   if (countersMapLong.containsKey(key)) {
     countersMapLong.get(key).add(value);
     // return (int) countersMapLong.get(key).get();
     return value;
   } else {
     Counter count = new Counter();
     count.set((long) value);
     countersMapLong.putIfAbsent(key, count);
     return value;
   }
 }