hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject hbase git commit: HBASE-14963. Remove Guava dependency from HBase client code
Date Fri, 22 Jan 2016 21:27:50 GMT
Repository: hbase
Updated Branches:
  refs/heads/master f9e69b51e -> 4681827d6


HBASE-14963. Remove Guava dependency from HBase client code


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

Branch: refs/heads/master
Commit: 4681827d63be77eae1ee83efa7faf15b9fe214bc
Parents: f9e69b5
Author: Devaraj Das <ddas@apache.org>
Authored: Fri Jan 22 13:26:54 2016 -0800
Committer: Devaraj Das <ddas@apache.org>
Committed: Fri Jan 22 13:26:54 2016 -0800

----------------------------------------------------------------------
 .../hbase/zookeeper/MetaTableLocator.java       | 23 ++++++++------------
 1 file changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4681827d/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
index 3cffd04..0b844a2 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
@@ -55,7 +55,6 @@ import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.ipc.RemoteException;
 import org.apache.zookeeper.KeeperException;
 
-import com.google.common.base.Stopwatch;
 import com.google.protobuf.InvalidProtocolBufferException;
 
 /**
@@ -229,11 +228,11 @@ public class MetaTableLocator {
    * @throws InterruptedException if interrupted while waiting
    */
   public void waitMetaRegionLocation(ZooKeeperWatcher zkw) throws InterruptedException {
-    Stopwatch stopwatch = new Stopwatch().start();
+    long startTime = System.currentTimeMillis();
     while (!stopped) {
       try {
         if (waitMetaRegionLocation(zkw, 100) != null) break;
-        long sleepTime = stopwatch.elapsedMillis();
+        long sleepTime = System.currentTimeMillis() - startTime;
         // +1 in case sleepTime=0
         if ((sleepTime + 1) % 10000 == 0) {
           LOG.warn("Have been waiting for meta to be assigned for " + sleepTime + "ms");
@@ -591,19 +590,15 @@ public class MetaTableLocator {
   throws InterruptedException {
     if (timeout < 0) throw new IllegalArgumentException();
     if (zkw == null) throw new IllegalArgumentException();
-    Stopwatch sw = new Stopwatch().start();
+    long startTime = System.currentTimeMillis();
     ServerName sn = null;
-    try {
-      while (true) {
-        sn = getMetaRegionLocation(zkw, replicaId);
-        if (sn != null || sw.elapsedMillis()
-            > timeout - HConstants.SOCKET_RETRY_WAIT_MS) {
-          break;
-        }
-        Thread.sleep(HConstants.SOCKET_RETRY_WAIT_MS);
+    while (true) {
+      sn = getMetaRegionLocation(zkw, replicaId);
+      if (sn != null || (System.currentTimeMillis() - startTime) 
+          > timeout - HConstants.SOCKET_RETRY_WAIT_MS) {
+        break;
       }
-    } finally {
-      sw.stop();
+      Thread.sleep(HConstants.SOCKET_RETRY_WAIT_MS);
     }
     return sn;
   }


Mime
View raw message