hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1595524 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
Date Sat, 17 May 2014 18:18:39 GMT
Author: liyin
Date: Sat May 17 18:18:39 2014
New Revision: 1595524

URL: http://svn.apache.org/r1595524
Log:
[HBASE-11187] Fix TableServers for jdk7

Author: manukranthk

Summary: TableServers was using a jdk8 feature.  Since we still build on jdk7 this diff fixes
the issue

Test Plan: git co fix_table_servers  && mvn clean test -Dtest=TestLoadShedding

Reviewers: rshroff, daviddeng, aaiyer, elliott

Reviewed By: daviddeng

Subscribers: manukranthk, elliot, daviddeng, adela

Differential Revision: https://phabricator.fb.com/D1333896

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java?rev=1595524&r1=1595523&r2=1595524&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java
Sat May 17 18:18:39 2014
@@ -50,7 +50,6 @@ import java.util.concurrent.FutureTask;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.Function;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
@@ -3357,11 +3356,7 @@ private HRegionLocation locateMetaInRoot
 
   void validateAndIncrementNumOutstandingPerServer(HServerAddress address)
       throws TooManyOutstandingRequestsException {
-    AtomicInteger atomicOutstanding = outstandingRequests.computeIfAbsent(address, new Function<HServerAddress,
AtomicInteger>() {
-      @Override public AtomicInteger apply(HServerAddress address) {
-        return new AtomicInteger(0);
-      }
-    });
+    AtomicInteger atomicOutstanding = getOutstandingCount(address);
 
     int outstanding = atomicOutstanding.get();
     if (outstanding > maxOutstandRequestsPerServer) {
@@ -3371,14 +3366,18 @@ private HRegionLocation locateMetaInRoot
   }
 
   void decrementNumOutstandingPerServer(HServerAddress address) {
-    AtomicInteger outstanding = outstandingRequests.computeIfAbsent(address, new Function<HServerAddress,
AtomicInteger>() {
-      @Override public AtomicInteger apply(HServerAddress address) {
-        return new AtomicInteger(0);
-      }
-    });
+    AtomicInteger outstanding = getOutstandingCount(address);
     outstanding.decrementAndGet();
   }
 
+  private AtomicInteger getOutstandingCount(HServerAddress address) {
+    AtomicInteger out = outstandingRequests.get(address);
+    if (out == null) {
+      out = outstandingRequests.putIfAbsent(address, new AtomicInteger(0));
+    }
+    return out;
+  }
+
   @Override
   public Configuration getConf() {
     return this.conf;



Mime
View raw message