private HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
    throws NotServingRegionException {
    HRegion region = this.onlineRegions.get(encodedRegionName);
    if (region == null) {
      MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
      if (moveInfo != null) {
        throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
      }
      Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
      String regionNameStr =
        regionName == null ? encodedRegionName : Bytes.toStringBinary(regionName);
      if (isOpening != null && isOpening) {
        throw new RegionOpeningException(
          "Region " + regionNameStr + " is opening on " + this.serverName);
      }
      throw new NotServingRegionException(
        "" + regionNameStr + " is not online on " + this.serverName);
    }
    return region;
  }
Protected Utility method for safely obtaining an HRegion handle.
@param regionName Name of online {@link HRegion} to return
@return {@link HRegion} for <code>regionName</code>
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java