hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerry...@apache.org
Subject hbase git commit: HBASE-14963 Remove use of Guava Stopwatch from HBase client code (Devaraj Das)
Date Sat, 19 Mar 2016 20:22:23 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 ce00fc1bc -> c2cd23fee


HBASE-14963 Remove use of Guava Stopwatch from HBase client code (Devaraj Das)


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

Branch: refs/heads/branch-1.3
Commit: c2cd23fee98f34b846b4c43a9141f9bab598ae6a
Parents: ce00fc1
Author: Jerry He <jerryjch@apache.org>
Authored: Sat Mar 19 13:21:53 2016 -0700
Committer: Jerry He <jerryjch@apache.org>
Committed: Sat Mar 19 13:21:53 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/c2cd23fe/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 0975c14..dc25bab 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
@@ -54,7 +54,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;
 
 /**
@@ -228,11 +227,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");
@@ -590,19 +589,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