You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/08/17 07:13:54 UTC
svn commit: r1158518 - in /hbase/trunk: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/ServerName.java
Author: stack
Date: Wed Aug 17 05:13:54 2011
New Revision: 1158518
URL: http://svn.apache.org/viewvc?rev=1158518&view=rev
Log:
HBASE-4211 Do init-sizing of the StringBuilder making a ServerName
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ServerName.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1158518&r1=1158517&r2=1158518&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed Aug 17 05:13:54 2011
@@ -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)
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ServerName.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ServerName.java?rev=1158518&r1=1158517&r2=1158518&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ServerName.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ServerName.java Wed Aug 17 05:13:54 2011
@@ -128,7 +128,8 @@ public class ServerName implements Compa
* 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 Compa
* @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 Compa
return left.getHostname().equals(right.getHostname()) &&
left.getPort() == right.getPort();
}
-}
\ No newline at end of file
+}