Source:
public void process() throws IOException { HRegionServer rss = getServer(); try { byte[] encodedRegionNameAsBytes = Bytes.toBytes(this.encodedRegionName); Boolean previous = rss.getRegionsInTransitionInRS(). putIfAbsent(encodedRegionNameAsBytes, Boolean.FALSE); if (previous != null) { if (previous) { long backoff = this.retryCounter.getBackoffTimeAndIncrementAttempts(); LOG.warn("Received CLOSE for which is being OPENED; try again after {}ms", encodedRegionNameAsBytes, backoff); rss.getExecutorService().delayedSubmit(this, backoff, TimeUnit.MILLISECONDS); } else { LOG.info("Received CLOSE for {}, which is CLOSING but not complete yet", encodedRegionNameAsBytes); } return; } HRegion region = rss.getRegion(this.encodedRegionName); if (region == null) { LOG.debug("Received CLOSE for which is not online, and we're not opening/closing.", this.encodedRegionName); rss.getRegionsInTransitionInRS().remove(encodedRegionNameAsBytes, Boolean.FALSE); return; } CloseRegionHandler crh = new CloseRegionHandler(rss, region.getRegionInfo(), this.abort, this.destination) { @Override boolean reportRegionStateTransition() throws IOException { boolean b = super.reportRegionStateTransition(); if (!b) { String name = getRegionInfo().getRegionNameAsString(); throw new IOException("Failed report close of " + name + " to master"); } return b; } @Override long getClosePID() { return UnassignRegionHandler.this.closeProcId; } }; crh.process(); } finally { rss.finishRegionProcedure(closeProcId); } }

Target:
public void process() throws IOException { HRegionServer rs = getServer(); byte[] encodedNameBytes = Bytes.toBytes(encodedName); Boolean previous = rs.getRegionsInTransitionInRS().putIfAbsent(encodedNameBytes, Boolean.FALSE); if (previous != null) { if (previous) { long backoff = retryCounter.getBackoffTimeAndIncrementAttempts(); LOG.warn("Received CLOSE for the region: {}, which we are already " + "trying to OPEN. try again after {}ms", encodedName, backoff); rs.getExecutorService().delayedSubmit(this, backoff, TimeUnit.MILLISECONDS); } else { LOG.info("Received CLOSE for the region: {}, which we are already trying to CLOSE," + " but not completed yet", encodedName); } return; } HRegion region = rs.getRegion(encodedName); if (region == null) { LOG.debug( "Received CLOSE for a region which is not online, and we're not opening/closing.", encodedName); rs.getRegionsInTransitionInRS().remove(encodedNameBytes, Boolean.FALSE); return; } String regionName = region.getRegionInfo().getEncodedName(); LOG.info("Close {}", regionName); if (region.getCoprocessorHost() != null) { region.getCoprocessorHost().preClose(abort); } if (region.close(abort) == null) { LOG.warn("Can't close region {}, was already closed during close()", regionName); rs.getRegionsInTransitionInRS().remove(encodedNameBytes, Boolean.FALSE); return; } rs.removeRegion(region, destination); if (!rs.reportRegionStateTransition(new RegionStateTransitionContext(TransitionCode.CLOSED, HConstants.NO_SEQNUM, closeProcId, -1, region.getRegionInfo()))) { throw new IOException("Failed to report close to master: " + regionName); } rs.finishRegionProcedure(closeProcId); rs.getRegionsInTransitionInRS().remove(encodedNameBytes, Boolean.FALSE); LOG.info("Closed {}", regionName); }