public static int getCounterNameMax() { if (!isInited) { init(null); } return COUNTER_NAME_MAX; }
public synchronized void incrCounters() { checkCounters(totalCounters + 1); ++totalCounters; }
public static String filterGroupName(String name) { return filterName(name, getGroupNameMax()); }
public static String filterCounterName(String name) { return filterName(name, getCounterNameMax()); }
if (newGroupName == null) { groupNameInLegacyMap = false; newGroupName = Limits.filterGroupName(groupName); fgroups.put(newGroupName, group); } else { limits.checkGroups(groups.size() + 1); groups.put(newGroupName, group);
@Override public T findCounter(String counterName, boolean create) { return findCounterImpl(Limits.filterCounterName(counterName), create); }
/** 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; }
public synchronized void checkCounters(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = getCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: "+ size + " max="+ countersMax); throw firstViolation; } }
public synchronized void checkGroups(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int groupsMax = getGroupsMax(); if (size > groupsMax) { firstViolation = new LimitExceededException("Too many counter groups: "+ size +" max="+ groupsMax); } }
public static String filterCounterName(String name) { return filterName(name, getCounterNameMax()); }
if (newGroupName == null) { groupNameInLegacyMap = false; newGroupName = Limits.filterGroupName(groupName); fgroups.put(newGroupName, group); } else { limits.checkGroups(groups.size() + 1); groups.put(newGroupName, group);
@Override public T findCounter(String counterName, boolean create) { return findCounterImpl(Limits.filterCounterName(counterName), create); }
/** 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; }
public synchronized void checkCounters(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = getCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: "+ size + " max="+ countersMax); throw firstViolation; } }
public synchronized void checkGroups(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int groupsMax = getGroupsMax(); if (size > groupsMax) { firstViolation = new LimitExceededException("Too many counter groups: "+ size +" max="+ groupsMax); } }
public static int getGroupsMax() { if (!isInited) { init(null); } return GROUPS_MAX; }
public static String filterGroupName(String name) { return filterName(name, getGroupNameMax()); }
public static String filterCounterName(String name) { return filterName(name, getCounterNameMax()); }
if (newGroupName == null) { groupNameInLegacyMap = false; newGroupName = Limits.filterGroupName(groupName); fgroups.put(newGroupName, group); } else { limits.checkGroups(groups.size() + 1); groups.put(newGroupName, group);
@Override public T findCounter(String counterName, boolean create) { return findCounterImpl(Limits.filterCounterName(counterName), create); }