@Override public String getName() { return realGroup.getName(); }
@Override public String getName() { return realGroup.getName(); }
@Override public String getName() { return realGroup.getName(); }
@Override public String getName() { return realGroup.getName(); }
/** Add a group. * @param group object to add * @return the group */ @InterfaceAudience.Private public synchronized G addGroup(G group) { String name = group.getName(); if (isFrameworkGroup(name)) { fgroups.put(name, group); } else { limits.checkGroups(groups.size() + 1); groups.put(name, group); } return group; }
/** Add a group. * @param group object to add * @return the group */ @InterfaceAudience.Private public synchronized G addGroup(G group) { String name = group.getName(); if (isFrameworkGroup(name)) { fgroups.put(name, group); } else { limits.checkGroups(groups.size() + 1); groups.put(name, group); } return group; }
/** Add a group. * @param group object to add * @return the group */ @InterfaceAudience.Private public synchronized G addGroup(G group) { String name = group.getName(); if (isFrameworkGroup(name)) { fgroups.put(name, group); } else { limits.checkGroups(groups.size() + 1); groups.put(name, group); } return group; }
/** Add a group. * @param group object to add * @return the group */ @InterfaceAudience.Private public synchronized G addGroup(G group) { String name = group.getName(); if (isFrameworkGroup(name)) { fgroups.put(name, group); } else { limits.checkGroups(groups.size() + 1); groups.put(name, group); } return group; }
/** * Increments multiple counters by their amounts in another Counters * instance. * @param other the other Counters instance */ public synchronized void incrAllCounters(AbstractCounters<C, G> other) { for(G right : other) { String groupName = right.getName(); G left = (isFrameworkGroup(groupName) ? fgroups : groups).get(groupName); if (left == null) { left = addGroup(groupName, right.getDisplayName()); } left.incrAllCounters(right); } }
/** * Increments multiple counters by their amounts in another Counters * instance. * @param other the other Counters instance */ public synchronized void incrAllCounters(AbstractCounters<C, G> other) { for(G right : other) { String groupName = right.getName(); G left = (isFrameworkGroup(groupName) ? fgroups : groups).get(groupName); if (left == null) { left = addGroup(groupName, right.getDisplayName()); } left.incrAllCounters(right); } }
/** * Increments multiple counters by their amounts in another Counters * instance. * @param other the other Counters instance */ public synchronized void incrAllCounters(AbstractCounters<C, G> other) { for(G right : other) { String groupName = right.getName(); G left = (isFrameworkGroup(groupName) ? fgroups : groups).get(groupName); if (left == null) { left = addGroup(groupName, right.getDisplayName()); } left.incrAllCounters(right); } }
/** * Increments multiple counters by their amounts in another Counters * instance. * @param other the other Counters instance */ public synchronized void incrAllCounters(AbstractCounters<C, G> other) { for(G right : other) { String groupName = right.getName(); G left = (isFrameworkGroup(groupName) ? fgroups : groups).get(groupName); if (left == null) { left = addGroup(groupName, right.getDisplayName()); } left.incrAllCounters(right); } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }
/** * Construct from another counters object. * @param <C1> type of the other counter * @param <G1> type of the other counter group * @param counters the counters object to copy * @param groupFactory the factory for new groups */ @InterfaceAudience.Private public <C1 extends Counter, G1 extends CounterGroupBase<C1>> AbstractCounters(AbstractCounters<C1, G1> counters, CounterGroupFactory<C, G> groupFactory) { this.groupFactory = groupFactory; for(G1 group: counters) { String name = group.getName(); G newGroup = groupFactory.newGroup(name, group.getDisplayName(), limits); (isFrameworkGroup(name) ? fgroups : groups).put(name, newGroup); for(Counter counter: group) { newGroup.addCounter(counter.getName(), counter.getDisplayName(), counter.getValue()); } } }
/** * Construct from another counters object. * @param <C1> type of the other counter * @param <G1> type of the other counter group * @param counters the counters object to copy * @param groupFactory the factory for new groups */ @InterfaceAudience.Private public <C1 extends Counter, G1 extends CounterGroupBase<C1>> AbstractCounters(AbstractCounters<C1, G1> counters, CounterGroupFactory<C, G> groupFactory) { this.groupFactory = groupFactory; for(G1 group: counters) { String name = group.getName(); G newGroup = groupFactory.newGroup(name, group.getDisplayName(), limits); (isFrameworkGroup(name) ? fgroups : groups).put(name, newGroup); for(Counter counter: group) { newGroup.addCounter(counter.getName(), counter.getDisplayName(), counter.getValue()); } } }
/** * Construct from another counters object. * @param <C1> type of the other counter * @param <G1> type of the other counter group * @param counters the counters object to copy * @param groupFactory the factory for new groups */ @InterfaceAudience.Private public <C1 extends Counter, G1 extends CounterGroupBase<C1>> AbstractCounters(AbstractCounters<C1, G1> counters, CounterGroupFactory<C, G> groupFactory) { this.groupFactory = groupFactory; for(G1 group: counters) { String name = group.getName(); G newGroup = groupFactory.newGroup(name, group.getDisplayName(), limits); (isFrameworkGroup(name) ? fgroups : groups).put(name, newGroup); for(Counter counter: group) { newGroup.addCounter(counter.getName(), counter.getDisplayName(), counter.getValue()); } } }
/** * Construct from another counters object. * @param <C1> type of the other counter * @param <G1> type of the other counter group * @param counters the counters object to copy * @param groupFactory the factory for new groups */ @InterfaceAudience.Private public <C1 extends Counter, G1 extends CounterGroupBase<C1>> AbstractCounters(AbstractCounters<C1, G1> counters, CounterGroupFactory<C, G> groupFactory) { this.groupFactory = groupFactory; for(G1 group: counters) { String name = group.getName(); G newGroup = groupFactory.newGroup(name, group.getDisplayName(), limits); (isFrameworkGroup(name) ? fgroups : groups).put(name, newGroup); for(Counter counter: group) { newGroup.addCounter(counter.getName(), counter.getDisplayName(), counter.getValue()); } } }