hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject svn commit: r1569733 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util: FSUtils.java HBaseFsck.java JVMClusterUtil.java
Date Wed, 19 Feb 2014 13:13:16 GMT
Author: nkeywal
Date: Wed Feb 19 13:13:16 2014
New Revision: 1569733

URL: http://svn.apache.org/r1569733
Log:
HBASE-10523 Correct wrong handling and add proper handling for swallowed InterruptedException
thrown by Thread.sleep in util (Feng Honghua)

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1569733&r1=1569732&r2=1569733&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Wed Feb
19 13:13:16 2014
@@ -645,8 +645,8 @@ public abstract class FSUtils {
             if (wait > 0) {
               Thread.sleep(wait);
             }
-          } catch (InterruptedException ex) {
-            // ignore
+          } catch (InterruptedException ie) {
+            throw (InterruptedIOException)new InterruptedIOException().initCause(ie);
           }
           retries--;
         } else {
@@ -676,8 +676,8 @@ public abstract class FSUtils {
               ", retrying in "+wait+"msec: "+StringUtils.stringifyException(ioe));
           try {
             Thread.sleep(wait);
-          } catch (InterruptedException ie) {
-            throw (InterruptedIOException)new InterruptedIOException().initCause(ie);
+          } catch (InterruptedException e) {
+            throw (InterruptedIOException)new InterruptedIOException().initCause(e);
           }
         } else {
           throw ioe;
@@ -783,9 +783,8 @@ public abstract class FSUtils {
               ", retrying in " + wait + "msec: " + StringUtils.stringifyException(ioe));
           try {
             Thread.sleep(wait);
-          } catch (InterruptedException ie) {
-            Thread.currentThread().interrupt();
-            break;
+          } catch (InterruptedException e) {
+            throw (InterruptedIOException)new InterruptedIOException().initCause(e);
           }
         } else {
           throw ioe;
@@ -852,7 +851,7 @@ public abstract class FSUtils {
       try {
         Thread.sleep(wait);
       } catch (InterruptedException e) {
-        //continue
+        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
       }
     }
   }
@@ -1910,4 +1909,4 @@ public abstract class FSUtils {
     int hbaseSize = conf.getInt("hbase." + dfsKey, defaultSize);
     conf.setIfUnset(dfsKey, Integer.toString(hbaseSize));
   }
-}
\ No newline at end of file
+}

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1569733&r1=1569732&r2=1569733&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java Wed
Feb 19 13:13:16 2014
@@ -4043,6 +4043,7 @@ public class HBaseFsck extends Configure
           LOG.info("Sleeping " + sleepBeforeRerun + "ms before re-checking after fix...");
           Thread.sleep(sleepBeforeRerun);
         } catch (InterruptedException ie) {
+          LOG.warn("Interrupted while sleeping");
           return this;
         }
         // Just report

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java?rev=1569733&r1=1569732&r2=1569733&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
Wed Feb 19 13:13:16 2014
@@ -18,6 +18,7 @@
  */
 package org.apache.hadoop.hbase.util;
 
+import java.io.InterruptedIOException;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.reflect.Constructor;
@@ -184,7 +185,8 @@ public class JVMClusterUtil {
     while (findActiveMaster(masters) == null) {
       try {
         Thread.sleep(100);
-      } catch (InterruptedException ignored) {
+      } catch (InterruptedException e) {
+        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
       }
       if (System.currentTimeMillis() > startTime + 30000) {
         throw new RuntimeException("Master not active after 30 seconds");
@@ -211,8 +213,11 @@ public class JVMClusterUtil {
       }
       // REMOVE
       if (System.currentTimeMillis() > startTime + 10000) {
-
-        Threads.sleep(1000);
+        try {
+          Thread.sleep(1000);
+        } catch (InterruptedException e) {
+          throw (InterruptedIOException)new InterruptedIOException().initCause(e);
+        }
       }
       if (System.currentTimeMillis() > startTime + maxwait) {
         String msg = "Master not initialized after " + maxwait + "ms seconds";
@@ -222,8 +227,8 @@ public class JVMClusterUtil {
       }
       try {
         Thread.sleep(100);
-      } catch (InterruptedException ignored) {
-        // Keep waiting
+      } catch (InterruptedException e) {
+        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
       }
     }
   }



Mime
View raw message