private CountersPBImpl convertFromProtoFormat(CountersProto p) { return new CountersPBImpl(p); }
private void mergeLocalToBuilder() { if (this.counterGroups != null) { addCounterGroupsToProto(); } }
private CountersProto convertToProtoFormat(Counters t) { return ((CountersPBImpl)t).getProto(); }
@Override public Map<String, CounterGroup> getAllCounterGroups() { initCounterGroups(); return this.counterGroups; } @Override
private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
@Override public void incrCounter(Enum<?> key, long amount) { String groupName = key.getDeclaringClass().getName(); if (getCounterGroup(groupName) == null) { CounterGroup cGrp = new CounterGroupPBImpl(); cGrp.setName(groupName); cGrp.setDisplayName(groupName); setCounterGroup(groupName, cGrp); } if (getCounterGroup(groupName).getCounter(key.name()) == null) { Counter c = new CounterPBImpl(); c.setName(key.name()); c.setDisplayName(key.name()); c.setValue(0l); getCounterGroup(groupName).setCounter(key.name(), c); } Counter counter = getCounterGroup(groupName).getCounter(key.name()); counter.setValue(counter.getValue() + amount); }
private void initCounterGroups() { if (this.counterGroups != null) { return; } CountersProtoOrBuilder p = viaProto ? proto : builder; List<StringCounterGroupMapProto> list = p.getCounterGroupsList(); this.counterGroups = new HashMap<String, CounterGroup>(); for (StringCounterGroupMapProto c : list) { this.counterGroups.put(c.getKey(), convertFromProtoFormat(c.getValue())); } }
@Override public Counter getCounter(Enum<?> key) { CounterGroup group = getCounterGroup(key.getDeclaringClass().getName()); return group == null ? null : group.getCounter(key.name()); }
public CountersProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
private void addCounterGroupsToProto() { maybeInitBuilder(); builder.clearCounterGroups(); if (counterGroups == null)
@Override public Map<String, CounterGroup> getAllCounterGroups() { initCounterGroups(); return this.counterGroups; } @Override
private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
@Override public void incrCounter(Enum<?> key, long amount) { String groupName = key.getDeclaringClass().getName(); if (getCounterGroup(groupName) == null) { CounterGroup cGrp = new CounterGroupPBImpl(); cGrp.setName(groupName); cGrp.setDisplayName(groupName); setCounterGroup(groupName, cGrp); } if (getCounterGroup(groupName).getCounter(key.name()) == null) { Counter c = new CounterPBImpl(); c.setName(key.name()); c.setDisplayName(key.name()); c.setValue(0l); getCounterGroup(groupName).setCounter(key.name(), c); } Counter counter = getCounterGroup(groupName).getCounter(key.name()); counter.setValue(counter.getValue() + amount); }
private void initCounterGroups() { if (this.counterGroups != null) { return; } CountersProtoOrBuilder p = viaProto ? proto : builder; List<StringCounterGroupMapProto> list = p.getCounterGroupsList(); this.counterGroups = new HashMap<String, CounterGroup>(); for (StringCounterGroupMapProto c : list) { this.counterGroups.put(c.getKey(), convertFromProtoFormat(c.getValue())); } }
@Override public Counter getCounter(Enum<?> key) { CounterGroup group = getCounterGroup(key.getDeclaringClass().getName()); return group == null ? null : group.getCounter(key.name()); }
public CountersProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
private void addCounterGroupsToProto() { maybeInitBuilder(); builder.clearCounterGroups(); if (counterGroups == null)
@Override public Map<String, CounterGroup> getAllCounterGroups() { initCounterGroups(); return this.counterGroups; } @Override
private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
@Override public void incrCounter(Enum<?> key, long amount) { String groupName = key.getDeclaringClass().getName(); if (getCounterGroup(groupName) == null) { CounterGroup cGrp = new CounterGroupPBImpl(); cGrp.setName(groupName); cGrp.setDisplayName(groupName); setCounterGroup(groupName, cGrp); } if (getCounterGroup(groupName).getCounter(key.name()) == null) { Counter c = new CounterPBImpl(); c.setName(key.name()); c.setDisplayName(key.name()); c.setValue(0l); getCounterGroup(groupName).setCounter(key.name(), c); } Counter counter = getCounterGroup(groupName).getCounter(key.name()); counter.setValue(counter.getValue() + amount); }