Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43B1B108C2 for ; Wed, 19 Feb 2014 13:13:49 +0000 (UTC) Received: (qmail 17644 invoked by uid 500); 19 Feb 2014 13:13:48 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 17417 invoked by uid 500); 19 Feb 2014 13:13:41 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 17403 invoked by uid 99); 19 Feb 2014 13:13:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Feb 2014 13:13:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Feb 2014 13:13:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F408623888E4; Wed, 19 Feb 2014 13:13:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@hbase.apache.org From: nkeywal@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140219131316.F408623888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); } } }