HBASE-4211 Do init-sizing of the StringBuilder making a ServerName
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1158518 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5b4b4c74e8
commit
4e403eb78b
|
@ -200,6 +200,8 @@ Release 0.91.0 - Unreleased
|
|||
HBASE-4186 No region is added to regionsInTransitionInRS
|
||||
HBASE-4194 RegionSplitter: Split on under-loaded region servers first
|
||||
HBASE-2399 Forced splits only act on the first family in a table (Ming Ma)
|
||||
HBASE-4211 Do init-sizing of the StringBuilder making a ServerName
|
||||
(Benoît Sigoure)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
||||
|
|
|
@ -128,7 +128,8 @@ public class ServerName implements Comparable<ServerName> {
|
|||
* startcode formatted as <code><hostname> ',' <port> ',' <startcode></code>
|
||||
*/
|
||||
public static String getServerName(String hostName, int port, long startcode) {
|
||||
StringBuilder name = new StringBuilder(hostName);
|
||||
final StringBuilder name = new StringBuilder(hostName.length() + 1 + 5 + 1 + 13);
|
||||
name.append(hostName);
|
||||
name.append(SERVERNAME_SEPARATOR);
|
||||
name.append(port);
|
||||
name.append(SERVERNAME_SEPARATOR);
|
||||
|
@ -142,7 +143,7 @@ public class ServerName implements Comparable<ServerName> {
|
|||
* @return Server name made of the concatenation of hostname, port and
|
||||
* startcode formatted as <code><hostname> ',' <port> ',' <startcode></code>
|
||||
*/
|
||||
public static synchronized String getServerName(final String hostAndPort,
|
||||
public static String getServerName(final String hostAndPort,
|
||||
final long startcode) {
|
||||
int index = hostAndPort.indexOf(":");
|
||||
if (index <= 0) throw new IllegalArgumentException("Expected <hostname> ':' <port>");
|
||||
|
@ -229,4 +230,4 @@ public class ServerName implements Comparable<ServerName> {
|
|||
return left.getHostname().equals(right.getHostname()) &&
|
||||
left.getPort() == right.getPort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue