HBASE-10523 Correct wrong handling and add proper handling for swallowed InterruptedException thrown by Thread.sleep in util (Feng Honghua)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1569733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
96a5ef9131
commit
b165690999
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4043,6 +4043,7 @@ public class HBaseFsck extends Configured {
|
|||
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue