Skip to content
Permalink
Browse files
HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join…
… while interrupted (#4352)

Signed-off-by: Xin Sun <ddupgs@gmail.com>
  • Loading branch information
Apache9 committed Apr 17, 2022
1 parent 48c4a46 commit 35aa57e4452c6f0a7f5037371edca64163913345
Showing 1 changed file with 10 additions and 2 deletions.
@@ -310,16 +310,20 @@ public String waitOnRegionServer(int serverNumber) {
* @return Name of region server that just went down.
*/
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
boolean interrupted = false;
while (rst.isAlive()) {
try {
LOG.info("Waiting on " + rst.getRegionServer().toString());
rst.join();
} catch (InterruptedException e) {
LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
Thread.currentThread().interrupt();
interrupted = true;
}
}
regionThreads.remove(rst);
if (interrupted) {
Thread.currentThread().interrupt();
}
return rst.getName();
}

@@ -383,17 +387,21 @@ public String waitOnMaster(int serverNumber) {
* @return Name of master that just went down.
*/
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
boolean interrupted = false;
while (masterThread.isAlive()) {
try {
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
masterThread.join();
} catch (InterruptedException e) {
LOG.error("Interrupted while waiting for {} to finish. Retrying join",
masterThread.getName(), e);
Thread.currentThread().interrupt();
interrupted = true;
}
}
masterThreads.remove(masterThread);
if (interrupted) {
Thread.currentThread().interrupt();
}
return masterThread.getName();
}

0 comments on commit 35aa57e

Please sign in to comment.