HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join while interrupted (#4352)
Signed-off-by: Xin Sun <ddupgs@gmail.com>
This commit is contained in:
parent
48c4a4626e
commit
35aa57e445
|
@ -310,16 +310,20 @@ public class LocalHBaseCluster {
|
||||||
* @return Name of region server that just went down.
|
* @return Name of region server that just went down.
|
||||||
*/
|
*/
|
||||||
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
|
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
|
||||||
|
boolean interrupted = false;
|
||||||
while (rst.isAlive()) {
|
while (rst.isAlive()) {
|
||||||
try {
|
try {
|
||||||
LOG.info("Waiting on " + rst.getRegionServer().toString());
|
LOG.info("Waiting on " + rst.getRegionServer().toString());
|
||||||
rst.join();
|
rst.join();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
|
LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
|
||||||
Thread.currentThread().interrupt();
|
interrupted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
regionThreads.remove(rst);
|
regionThreads.remove(rst);
|
||||||
|
if (interrupted) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
return rst.getName();
|
return rst.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,6 +387,7 @@ public class LocalHBaseCluster {
|
||||||
* @return Name of master that just went down.
|
* @return Name of master that just went down.
|
||||||
*/
|
*/
|
||||||
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
|
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
|
||||||
|
boolean interrupted = false;
|
||||||
while (masterThread.isAlive()) {
|
while (masterThread.isAlive()) {
|
||||||
try {
|
try {
|
||||||
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
|
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
|
||||||
|
@ -390,10 +395,13 @@ public class LocalHBaseCluster {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LOG.error("Interrupted while waiting for {} to finish. Retrying join",
|
LOG.error("Interrupted while waiting for {} to finish. Retrying join",
|
||||||
masterThread.getName(), e);
|
masterThread.getName(), e);
|
||||||
Thread.currentThread().interrupt();
|
interrupted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
masterThreads.remove(masterThread);
|
masterThreads.remove(masterThread);
|
||||||
|
if (interrupted) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
return masterThread.getName();
|
return masterThread.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue