HBASE-10520 Add handling for swallowed InterruptedException thrown by Thread.sleep in MiniZooKeeperCluster (Feng Honghua)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1570211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
57671618b5
commit
f20938d8ec
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.zookeeper;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InterruptedIOException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -322,7 +323,7 @@ public class MiniZooKeeperCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: From o.a.zk.t.ClientBase
|
// XXX: From o.a.zk.t.ClientBase
|
||||||
private static boolean waitForServerDown(int port, long timeout) {
|
private static boolean waitForServerDown(int port, long timeout) throws IOException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
@ -344,14 +345,14 @@ public class MiniZooKeeperCluster {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(250);
|
Thread.sleep(250);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// ignore
|
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: From o.a.zk.t.ClientBase
|
// XXX: From o.a.zk.t.ClientBase
|
||||||
private static boolean waitForServerUp(int port, long timeout) {
|
private static boolean waitForServerUp(int port, long timeout) throws IOException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
@ -385,7 +386,7 @@ public class MiniZooKeeperCluster {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(250);
|
Thread.sleep(250);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// ignore
|
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue