Source:
public void process() throws IOException { HRegionServer rs = getServer(); String encodedName = regionInfo.getEncodedName(); byte[] encodedNameBytes = regionInfo.getEncodedNameAsBytes(); String regionName = regionInfo.getRegionNameAsString(); Region onlineRegion = rs.getRegion(encodedName); if (onlineRegion != null) { LOG.warn("Received OPEN for the region:{}, which is already online", regionName); return; } Boolean previous = rs.getRegionsInTransitionInRS().putIfAbsent(encodedNameBytes, Boolean.TRUE); if (previous != null) { if (previous) { LOG.info("Receiving OPEN for the region:{}, which we are already trying to OPEN" + " - ignoring this new request for this region.", regionName); } else { long backoff = retryCounter.getBackoffTimeAndIncrementAttempts(); LOG.info( "Receiving OPEN for the region:{}, which we are trying to close, try again after {}ms", regionName, backoff); rs.getExecutorService().delayedSubmit(this, backoff, TimeUnit.MILLISECONDS); } return; } LOG.info("Open {}", regionName); HRegion region; try { TableDescriptor htd = tableDesc != null ? tableDesc : rs.getTableDescriptors().get(regionInfo.getTable()); if (htd == null) { throw new IOException("Missing table descriptor for " + regionName); } region = HRegion.openHRegion(regionInfo, htd, rs.getWAL(regionInfo), rs.getConfiguration(), rs, null); rs.postOpenDeployTasks(new PostOpenDeployContext(region, openProcId, masterSystemTime)); } catch (IOException e) { cleanUpAndReportFailure(e); return; } rs.addRegion(region); LOG.info("Opened {}", regionName); rs.finishRegionProcedure(openProcId); Boolean current = rs.getRegionsInTransitionInRS().remove(regionInfo.getEncodedNameAsBytes()); if (current == null) { LOG.error("Bad state: we've just opened a region that was NOT in transition. Region={}", regionName); } else if (!current) { LOG.error("Bad state: we've just opened a region that was closing. Region={}", regionName); } }

Target:
public void process() throws IOException { HRegionServer rs = getServer(); String encodedName = regionInfo.getEncodedName(); byte[] encodedNameBytes = regionInfo.getEncodedNameAsBytes(); String regionName = regionInfo.getRegionNameAsString(); Region onlineRegion = rs.getRegion(encodedName); if (onlineRegion != null) { LOG.warn("Received OPEN for the region:{}, which is already online", regionName); return; } Boolean previous = rs.getRegionsInTransitionInRS().putIfAbsent(encodedNameBytes, Boolean.TRUE); if (previous != null) { if (previous) { LOG.info("Receiving OPEN for the region:{}, which we are already trying to OPEN" + " - ignoring this new request for this region.", regionName); } else { long backoff = retryCounter.getBackoffTimeAndIncrementAttempts(); LOG.info( "Receiving OPEN for the region:{}, which we are trying to close, try again after {}ms", regionName, backoff); rs.getExecutorService().delayedSubmit(this, backoff, TimeUnit.MILLISECONDS); } return; } LOG.info("Open {}", regionName); HRegion region; try { TableDescriptor htd = tableDesc != null ? tableDesc : rs.getTableDescriptors().get(regionInfo.getTable()); if (htd == null) { throw new IOException("Missing table descriptor for " + regionName); } region = HRegion.openHRegion(regionInfo, htd, rs.getWAL(regionInfo), rs.getConfiguration(), rs, null); } catch (IOException e) { cleanUpAndReportFailure(e); return; } rs.postOpenDeployTasks(new PostOpenDeployContext(region, openProcId, masterSystemTime)); rs.addRegion(region); LOG.info("Opened {}", regionName); rs.finishRegionProcedure(openProcId); Boolean current = rs.getRegionsInTransitionInRS().remove(regionInfo.getEncodedNameAsBytes()); if (current == null) { LOG.error("Bad state: we've just opened a region that was NOT in transition. Region={}", regionName); } else if (!current) { LOG.error("Bad state: we've just opened a region that was closing. Region={}", regionName); } }