HDFS-9350. Avoid creating temprorary strings in Block.toString() and getBlockName() (Staffan Friberg via cmccabe)
(cherry picked from commit e63388fdf2
)
This commit is contained in:
parent
71fb205735
commit
31d2fb91fc
|
@ -132,7 +132,8 @@ public class Block implements Writable, Comparable<Block> {
|
|||
/**
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static String toString(final Block b) {
|
||||
return b.getBlockName() + "_" + b.getGenerationStamp();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
b.appendStringTo(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,6 +34,9 @@ Release 2.9.0 - UNRELEASED
|
|||
HDFS-8477. describe dfs.ha.zkfc.port in hdfs-default.xml.
|
||||
(Kanaka Kumar Avvaru via wang)
|
||||
|
||||
HDFS-9350. Avoid creating temprorary strings in Block.toString() and
|
||||
getBlockName() (Staffan Friberg via cmccabe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
Loading…
Reference in New Issue