Skip to content

Commit

Permalink
HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join…
Browse files Browse the repository at this point in the history
… while interrupted (apache#4352)

Signed-off-by: Xin Sun <[email protected]>
(cherry picked from commit 35aa57e)
  • Loading branch information
Apache9 committed Apr 17, 2022
1 parent eea9e78 commit d9f4c51
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +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) {
e.printStackTrace();
LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
interrupted = true;
}
}
regionThreads.remove(rst);
if (interrupted) {
Thread.currentThread().interrupt();
}
return rst.getName();
}

Expand Down Expand Up @@ -382,15 +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) {
e.printStackTrace();
LOG.error("Interrupted while waiting for {} to finish. Retrying join",
masterThread.getName(), e);
interrupted = true;
}
}
masterThreads.remove(masterThread);
if (interrupted) {
Thread.currentThread().interrupt();
}
return masterThread.getName();
}

Expand Down

0 comments on commit d9f4c51

Please sign in to comment.