HADOOP-11586. Update use of Iterator to Iterable in AbstractMetricsContext.java. Contributed by Ray Chiang.
(cherry picked from commit 11d8934463
)
This commit is contained in:
parent
380cc4dbed
commit
7d6c3c6dbe
|
@ -191,6 +191,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HADOOP-11543. Improve help message for hadoop/yarn command. (Brahma
|
HADOOP-11543. Improve help message for hadoop/yarn command. (Brahma
|
||||||
Reddy Battula via ozawa).
|
Reddy Battula via ozawa).
|
||||||
|
|
||||||
|
HADOOP-11586. Update use of Iterator to Iterable in
|
||||||
|
AbstractMetricsContext.java. (Ray Chiang via aajisaka)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11323. WritableComparator#compare keeps reference to byte array.
|
HADOOP-11323. WritableComparator#compare keeps reference to byte array.
|
||||||
|
|
|
@ -310,13 +310,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()) {
|
for (Map.Entry<String,RecordMap> recordEntry : bufferedData.entrySet()) {
|
||||||
RecordMap recordMap = bufferedData.get(recordName);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,8 +330,8 @@ public abstract class AbstractMetricsContext implements MetricsContext {
|
||||||
*/
|
*/
|
||||||
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()) {
|
for (Map.Entry<String,RecordMap> recordEntry : bufferedData.entrySet()) {
|
||||||
RecordMap recordMap = bufferedData.get(recordName);
|
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();
|
||||||
|
@ -339,7 +339,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;
|
||||||
|
|
Loading…
Reference in New Issue