Repository: hbase
Updated Branches:
  refs/heads/master 36d84a151 -> b47a3f692


HBASE-11458 NPEs if RegionServer cannot initialize


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b47a3f69
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b47a3f69
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b47a3f69

Branch: refs/heads/master
Commit: b47a3f6924e22a1ae3651c866382dd55c8103025
Parents: 36d84a1
Author: Enis Soztutar <e...@apache.org>
Authored: Mon Jul 7 20:35:40 2014 -0700
Committer: Enis Soztutar <e...@apache.org>
Committed: Mon Jul 7 20:35:40 2014 -0700

----------------------------------------------------------------------
 .../hbase/regionserver/HRegionServer.java       | 36 +++++++++++++++-----
 1 file changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b47a3f69/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 0048852..fb457ed 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -825,7 +825,9 @@ public class HRegionServer extends HasThread implements
       cacheConfig.getBlockCache().shutdown();
     }
 
-    movedRegionsCleaner.stop("Region Server stopping");
+    if (movedRegionsCleaner != null) {
+      movedRegionsCleaner.stop("Region Server stopping");
+    }
 
     // Send interrupts to wake up threads if sleeping so they notice shutdown.
     // TODO: Should we check they are alive? If OOME could have exited already
@@ -845,7 +847,9 @@ public class HRegionServer extends HasThread implements
     }
 
     // Stop the snapshot and other procedure handlers, forcefully killing all 
running tasks
-    rspmHost.stop(this.abortRequested || this.killed);
+    if (rspmHost != null) {
+      rspmHost.stop(this.abortRequested || this.killed);
+    }
 
     if (this.killed) {
       // Just skip out w/o closing regions.  Used when testing.
@@ -897,8 +901,12 @@ public class HRegionServer extends HasThread implements
     if (this.rssStub != null) {
       this.rssStub = null;
     }
-    this.rpcClient.stop();
-    this.leases.close();
+    if (this.rpcClient != null) {
+      this.rpcClient.stop();
+    }
+    if (this.leases != null) {
+      this.leases.close();
+    }
     if (this.pauseMonitor != null) {
       this.pauseMonitor.stop();
     }
@@ -907,7 +915,9 @@ public class HRegionServer extends HasThread implements
       stopServiceThreads();
     }
 
-    this.rpcServices.stop();
+    if (this.rpcServices != null) {
+      this.rpcServices.stop();
+    }
 
     try {
       deleteMyEphemeralNode();
@@ -918,7 +928,9 @@ public class HRegionServer extends HasThread implements
     //  we delete the file anyway: a second attempt to delete the znode is 
likely to fail again.
     ZNodeClearer.deleteMyEphemeralNodeOnDisk();
 
-    this.zooKeeper.close();
+    if (this.zooKeeper != null) {
+      this.zooKeeper.close();
+    }
     LOG.info("stopping server " + this.serverName +
       "; zookeeper connection closed.");
 
@@ -1852,9 +1864,15 @@ public class HRegionServer extends HasThread implements
     if (this.nonceManagerChore != null) {
       Threads.shutdown(this.nonceManagerChore.getThread());
     }
-    Threads.shutdown(this.compactionChecker.getThread());
-    Threads.shutdown(this.periodicFlusher.getThread());
-    this.cacheFlusher.join();
+    if (this.compactionChecker != null) {
+      Threads.shutdown(this.compactionChecker.getThread());
+    }
+    if (this.periodicFlusher != null) {
+      Threads.shutdown(this.periodicFlusher.getThread());
+    }
+    if (this.cacheFlusher != null) {
+      this.cacheFlusher.join();
+    }
     if (this.healthCheckChore != null) {
       Threads.shutdown(this.healthCheckChore.getThread());
     }

Reply via email to