Skip to content

Commit 35aa57e

Browse files
authored
HBASE-26941 LocalHBaseCluster.waitOnRegionServer should not call join while interrupted (#4352)
Signed-off-by: Xin Sun <[email protected]>
1 parent 48c4a46 commit 35aa57e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,16 +310,20 @@ public String waitOnRegionServer(int serverNumber) {
310310
* @return Name of region server that just went down.
311311
*/
312312
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
313+
boolean interrupted = false;
313314
while (rst.isAlive()) {
314315
try {
315316
LOG.info("Waiting on " + rst.getRegionServer().toString());
316317
rst.join();
317318
} catch (InterruptedException e) {
318319
LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
319-
Thread.currentThread().interrupt();
320+
interrupted = true;
320321
}
321322
}
322323
regionThreads.remove(rst);
324+
if (interrupted) {
325+
Thread.currentThread().interrupt();
326+
}
323327
return rst.getName();
324328
}
325329

@@ -383,17 +387,21 @@ public String waitOnMaster(int serverNumber) {
383387
* @return Name of master that just went down.
384388
*/
385389
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
390+
boolean interrupted = false;
386391
while (masterThread.isAlive()) {
387392
try {
388393
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
389394
masterThread.join();
390395
} catch (InterruptedException e) {
391396
LOG.error("Interrupted while waiting for {} to finish. Retrying join",
392397
masterThread.getName(), e);
393-
Thread.currentThread().interrupt();
398+
interrupted = true;
394399
}
395400
}
396401
masterThreads.remove(masterThread);
402+
if (interrupted) {
403+
Thread.currentThread().interrupt();
404+
}
397405
return masterThread.getName();
398406
}
399407

0 commit comments

Comments
 (0)