public static CounterGroupDictionary getInstance() throws JobCounterException { if (instance == null) { synchronized (CounterGroupDictionary.class) { if (instance == null) { CounterGroupDictionary tmp = new CounterGroupDictionary(); tmp.initialize(); instance = tmp; } } } return instance; }
private CounterGroupKey getCounterGroup(int groupIndex) throws JobCounterException { if (dictionary == null) { dictionary = CounterGroupDictionary.getInstance(); } return dictionary.getCounterGroupByIndex(groupIndex); }
private CounterGroupKey getCounterGroup(String groupName) throws JobCounterException { if (dictionary == null) { dictionary = CounterGroupDictionary.getInstance(); } final CounterGroupKey groupKey = dictionary.getCounterGroupByName(groupName); if (groupKey == null) { throw new JobCounterException("Invalid counter group name: " + groupName); } return groupKey; }
private boolean parseGroup(int groupIndex, Properties prop) { final String groupKeyBase = "counter.group" + groupIndex; final String groupNameKey = groupKeyBase + ".name"; final String groupName = prop.getProperty(groupNameKey); if (groupName == null) { return false; } final String groupDescriptionKey = groupKeyBase + ".description"; final String groupDescription = prop.getProperty(groupDescriptionKey); final CounterGroupKeyImpl groupKey = new CounterGroupKeyImpl(groupIndex, groupName, groupDescription); final ArrayList<CounterKey> counters = new ArrayList<CounterKey>(); int counterIndex = 0; while (parseCounter(groupKey, counterIndex, counters, prop)) { ++counterIndex; } groupKey.setCounterKeys(counters.toArray(new CounterKey[counters.size()])); groupKeys.add(groupKey); return true; }
while (parseGroup(groupIndex, prop)) { ++groupIndex;