hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1514899 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java
Date Fri, 16 Aug 2013 21:41:03 GMT
Author: eclark
Date: Fri Aug 16 21:41:03 2013
New Revision: 1514899

URL: http://svn.apache.org/r1514899
Log:
HBASE-9250 Make sure lease time isn't ever negative.

Sometimes nextLease.getDelay can return a negative number.  Trying to
sleep for a negative time thows an uncaught exception bringing down the
whole regionserver.

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java?rev=1514899&r1=1514898&r2=1514899&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java
Fri Aug 16 21:41:03 2013
@@ -56,6 +56,7 @@ import java.io.IOException;
 @InterfaceAudience.Private
 public class Leases extends HasThread {
   private static final Log LOG = LogFactory.getLog(Leases.class.getName());
+  public static final int MIN_WAIT_TIME = 100;
   private final Map<String, Lease> leases = new ConcurrentHashMap<String, Lease>();
 
   protected final int leaseCheckFrequency;
@@ -87,7 +88,10 @@ public class Leases extends HasThread {
         if (nextLease != null) {
           toWait = nextLease.getDelay(TimeUnit.MILLISECONDS);
         }
+
         toWait = Math.min(leaseCheckFrequency, toWait);
+        toWait = Math.max(MIN_WAIT_TIME, toWait);
+
         Thread.sleep(toWait);
       } catch (InterruptedException e) {
         continue;



Mime
View raw message