HDFS-9350. Avoid creating temprorary strings in Block.toString() and getBlockName() (Staffan Friberg via cmccabe)
This commit is contained in:
parent
f349d0a76c
commit
e63388fdf2
|
@ -132,7 +132,8 @@ public class Block implements Writable, Comparable<Block> {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public String getBlockName() {
|
public String getBlockName() {
|
||||||
return BLOCK_FILE_PREFIX + String.valueOf(blockId);
|
return new StringBuilder().append(BLOCK_FILE_PREFIX)
|
||||||
|
.append(blockId).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +161,9 @@ public class Block implements Writable, Comparable<Block> {
|
||||||
* @return the string representation of the block
|
* @return the string representation of the block
|
||||||
*/
|
*/
|
||||||
public static String toString(final Block b) {
|
public static String toString(final Block b) {
|
||||||
return b.getBlockName() + "_" + b.getGenerationStamp();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
b.appendStringTo(sb);
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -910,6 +910,9 @@ Release 2.9.0 - UNRELEASED
|
||||||
HDFS-8477. describe dfs.ha.zkfc.port in hdfs-default.xml.
|
HDFS-8477. describe dfs.ha.zkfc.port in hdfs-default.xml.
|
||||||
(Kanaka Kumar Avvaru via wang)
|
(Kanaka Kumar Avvaru via wang)
|
||||||
|
|
||||||
|
HDFS-9350. Avoid creating temprorary strings in Block.toString() and
|
||||||
|
getBlockName() (Staffan Friberg via cmccabe)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
Loading…
Reference in New Issue