|
@@ -318,13 +318,13 @@ public abstract class AbstractMetricsContext implements MetricsContext {
|
|
* Emits the records.
|
|
* Emits the records.
|
|
*/
|
|
*/
|
|
private synchronized void emitRecords() throws IOException {
|
|
private synchronized void emitRecords() throws IOException {
|
|
- for (String recordName : bufferedData.keySet()) {
|
|
|
|
- RecordMap recordMap = bufferedData.get(recordName);
|
|
|
|
|
|
+ for (Map.Entry<String,RecordMap> recordEntry : bufferedData.entrySet()) {
|
|
|
|
+ RecordMap recordMap = recordEntry.getValue();
|
|
synchronized (recordMap) {
|
|
synchronized (recordMap) {
|
|
Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet ();
|
|
Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet ();
|
|
for (Entry<TagMap, MetricMap> entry : entrySet) {
|
|
for (Entry<TagMap, MetricMap> entry : entrySet) {
|
|
OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
|
|
OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
|
|
- emitRecord(contextName, recordName, outRec);
|
|
|
|
|
|
+ emitRecord(contextName, recordEntry.getKey(), outRec);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -339,8 +339,8 @@ public abstract class AbstractMetricsContext implements MetricsContext {
|
|
@Override
|
|
@Override
|
|
public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
|
|
public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
|
|
Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
|
|
Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
|
|
- for (String recordName : bufferedData.keySet()) {
|
|
|
|
- RecordMap recordMap = bufferedData.get(recordName);
|
|
|
|
|
|
+ for (Map.Entry<String,RecordMap> recordEntry : bufferedData.entrySet()) {
|
|
|
|
+ RecordMap recordMap = recordEntry.getValue();
|
|
synchronized (recordMap) {
|
|
synchronized (recordMap) {
|
|
List<OutputRecord> records = new ArrayList<OutputRecord>();
|
|
List<OutputRecord> records = new ArrayList<OutputRecord>();
|
|
Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet();
|
|
Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet();
|
|
@@ -348,7 +348,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
|
|
OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
|
|
OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
|
|
records.add(outRec);
|
|
records.add(outRec);
|
|
}
|
|
}
|
|
- out.put(recordName, records);
|
|
|
|
|
|
+ out.put(recordEntry.getKey(), records);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return out;
|
|
return out;
|