You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/01/31 05:01:58 UTC

[06/10] git commit: Eliminiate an extra string creation unnecessarily

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/40c3319d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/40c3319d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/40c3319d

Branch: refs/heads/2292-findbugs
Commit: 40c3319d0e384be92565f64000496c4b7b575fac
Parents: 4fa2e62
Author: Josh Elser <el...@apache.org>
Authored: Thu Jan 30 17:23:19 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jan 30 17:23:19 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/40c3319d/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;