hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndimi...@apache.org
Subject git commit: HBASE-12399 Master startup race between metrics and RpcServer
Date Sat, 01 Nov 2014 17:50:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 687710eb2 -> c3a7f2f3b


HBASE-12399 Master startup race between metrics and RpcServer


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

Branch: refs/heads/branch-1
Commit: c3a7f2f3bbb2a12bfffeff6d181e619a1545c41a
Parents: 687710e
Author: Nick Dimiduk <ndimiduk@apache.org>
Authored: Fri Oct 31 17:48:09 2014 -0700
Committer: Nick Dimiduk <ndimiduk@apache.org>
Committed: Sat Nov 1 10:47:00 2014 -0700

----------------------------------------------------------------------
 .../hbase/ipc/MetricsHBaseServerWrapperImpl.java    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c3a7f2f3/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
index 09a9ea0..63c4b32 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
@@ -27,9 +27,13 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
     this.server = server;
   }
 
+  private boolean isServerStarted() {
+    return this.server != null && this.server.isStarted();
+  }
+
   @Override
   public long getTotalQueueSize() {
-    if (this.server == null) {
+    if (!isServerStarted()) {
       return 0;
     }
     return server.callQueueSize.get();
@@ -37,7 +41,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
 
   @Override
   public int getGeneralQueueLength() {
-    if (this.server == null || this.server.getScheduler() == null) {
+    if (!isServerStarted() || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getGeneralQueueLength();
@@ -45,7 +49,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
 
   @Override
   public int getReplicationQueueLength() {
-    if (this.server == null || this.server.getScheduler() == null) {
+    if (!isServerStarted() || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getReplicationQueueLength();
@@ -53,7 +57,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
 
   @Override
   public int getPriorityQueueLength() {
-    if (this.server == null || this.server.getScheduler() == null) {
+    if (!isServerStarted() || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getPriorityQueueLength();
@@ -61,7 +65,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
 
   @Override
   public int getNumOpenConnections() {
-    if (this.server == null || this.server.connectionList == null) {
+    if (!isServerStarted() || this.server.connectionList == null) {
       return 0;
     }
     return server.connectionList.size();
@@ -69,7 +73,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
 
   @Override
   public int getActiveRpcHandlerCount() {
-    if (this.server == null || this.server.getScheduler() == null) {
+    if (!isServerStarted() || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getActiveRpcHandlerCount();


Mime
View raw message