private LongGauge getSubscriptionCounter(InterestKey interestKey) { LongGauge counter = subscribedClientsByInterest.get(interestKey); if (counter == null) { synchronized (subscribedClientsByInterest) { counter = subscribedClientsByInterest.get(interestKey); if (counter == null) { counter = new LongGauge(monitorConfig("subscriptions." + interestKey.getCounterName())); subscribedClientsByInterest.put(interestKey, counter); register(counter); } } } return counter; }
public void decrementSubscriptionCounter(AtomicInterest interestType, String id) { if (interestType == AtomicInterest.Instance) { ServoUtils.decrementLongGauge(totalInstanceInterests); } if (interestType == AtomicInterest.InterestAll) { ServoUtils.decrementLongGauge(interestAllCounter); } else { ServoUtils.decrementLongGauge(getSubscriptionCounter(new InterestKey(interestType, id))); } }
public void incrementSubscriptionCounter(AtomicInterest interestType, String id) { if (interestType == AtomicInterest.Instance) { ServoUtils.incrementLongGauge(totalInstanceInterests); } if (interestType == AtomicInterest.InterestAll) { ServoUtils.incrementLongGauge(interestAllCounter); } else { ServoUtils.incrementLongGauge(getSubscriptionCounter(new InterestKey(interestType, id))); } }