accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [11/26] git commit: Eliminiate an extra string creation unnecessarily
Date Sat, 01 Feb 2014 03:23:10 GMT
Eliminiate an extra string creation unnecessarily


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/dcaae30e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/dcaae30e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/dcaae30e

Branch: refs/heads/2292-findbugs
Commit: dcaae30e1884cf4e87892d6b4d5277384fb9828c
Parents: 7d9a96a
Author: Josh Elser <elserj@apache.org>
Authored: Thu Jan 30 17:23:19 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Jan 31 22:18:52 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/core/client/impl/ServerClient.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcaae30e/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
index 0e301a5..5b97941 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
@@ -140,11 +140,13 @@ public class ServerClient {
     for (String tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS))
{
       String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver;
       byte[] data = ZooUtil.getLockData(zc, path);
-      if (data != null && !new String(data).equals("master"))
-        servers.add(new ThriftTransportKey(
-            new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT),

-            conf.getPort(Property.TSERV_CLIENTPORT), 
-            rpcTimeout));
+      if (data != null) {
+        String tserverData = new String(data, Constants.UTF8);
+        if (!tserverData.equals("master")) {
+          servers.add(new ThriftTransportKey(new ServerServices(tserverData).getAddressString(Service.TSERV_CLIENT),
conf.getPort(Property.TSERV_CLIENTPORT),
+              rpcTimeout));
+        }
+      }
     }
     
     boolean opened = false;


Mime
View raw message