Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1138205) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -1611,7 +1611,8 @@ @Override @QosPriority(priority=HIGH_QOS) public HRegionInfo getRegionInfo(final byte[] regionName) - throws NotServingRegionException { + throws NotServingRegionException, IOException { + checkOpen(); requestCount.incrementAndGet(); return getRegion(regionName).getRegionInfo(); } @@ -1927,9 +1928,9 @@ public int delete(final byte[] regionName, final List deletes) throws IOException { + checkOpen(); // Count of Deletes processed. int i = 0; - checkOpen(); HRegion region = null; try { boolean writeToWAL = true; @@ -2050,6 +2051,7 @@ @Override public void bulkLoadHFile(String hfilePath, byte[] regionName, byte[] familyName) throws IOException { + checkOpen(); HRegion region = getRegion(regionName); region.bulkLoadHFile(hfilePath, familyName); } @@ -2084,6 +2086,7 @@ @QosPriority(priority=HIGH_QOS) public void openRegion(HRegionInfo region) throws IOException { + checkOpen(); if (this.regionsInTransitionInRS.contains(region.getEncodedNameAsBytes())) { throw new RegionAlreadyInTransitionException("open", region.getEncodedName()); } @@ -2103,6 +2106,7 @@ @QosPriority(priority=HIGH_QOS) public void openRegions(List regions) throws IOException { + checkOpen(); LOG.info("Received request to open " + regions.size() + " region(s)"); for (HRegionInfo region: regions) openRegion(region); } @@ -2118,6 +2122,7 @@ @QosPriority(priority=HIGH_QOS) public boolean closeRegion(HRegionInfo region, final boolean zk) throws IOException { + checkOpen(); LOG.info("Received close region: " + region.getRegionNameAsString()); boolean hasit = this.onlineRegions.containsKey(region.getEncodedName()); if (!hasit) { @@ -2165,6 +2170,7 @@ @QosPriority(priority=HIGH_QOS) public void flushRegion(HRegionInfo regionInfo) throws NotServingRegionException, IOException { + checkOpen(); LOG.info("Flushing " + regionInfo.getRegionNameAsString()); HRegion region = getRegion(regionInfo.getRegionName()); region.flushcache(); @@ -2180,6 +2186,7 @@ @Override public void splitRegion(HRegionInfo regionInfo, byte[] splitPoint) throws NotServingRegionException, IOException { + checkOpen(); HRegion region = getRegion(regionInfo.getRegionName()); region.flushcache(); region.forceSplit(splitPoint); @@ -2194,6 +2201,7 @@ @QosPriority(priority=HIGH_QOS) public void compactRegion(HRegionInfo regionInfo, boolean major) throws NotServingRegionException, IOException { + checkOpen(); HRegion region = getRegion(regionInfo.getRegionName()); compactSplitThread.requestCompaction(region, major, "User-triggered " + (major ? "major " : "") + "compaction", @@ -2496,13 +2504,14 @@ @Override @QosPriority(priority=HIGH_QOS) public HServerInfo getHServerInfo() throws IOException { + checkOpen(); return serverInfo; } @SuppressWarnings("unchecked") @Override public MultiResponse multi(MultiAction multi) throws IOException { - + checkOpen(); MultiResponse response = new MultiResponse(); for (Map.Entry> e : multi.actions.entrySet()) { @@ -2597,6 +2606,7 @@ */ @Override public MultiPutResponse multiPut(MultiPut puts) throws IOException { + checkOpen(); MultiPutResponse resp = new MultiPutResponse(); // do each region as it's own. @@ -2698,6 +2708,7 @@ @Override public void replicateLogEntries(final HLog.Entry[] entries) throws IOException { + checkOpen(); if (this.replicationHandler == null) return; this.replicationHandler.replicateLogEntries(entries); }