HBASE-12399 Master startup race between metrics and RpcServer
This commit is contained in:
parent
3c06b48181
commit
b5764a8e74
|
@ -27,9 +27,13 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isServerStarted() {
|
||||||
|
return this.server != null && this.server.isStarted();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getTotalQueueSize() {
|
public long getTotalQueueSize() {
|
||||||
if (this.server == null) {
|
if (!isServerStarted()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return server.callQueueSize.get();
|
return server.callQueueSize.get();
|
||||||
|
@ -37,7 +41,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getGeneralQueueLength() {
|
public int getGeneralQueueLength() {
|
||||||
if (this.server == null || this.server.getScheduler() == null) {
|
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return server.getScheduler().getGeneralQueueLength();
|
return server.getScheduler().getGeneralQueueLength();
|
||||||
|
@ -45,7 +49,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getReplicationQueueLength() {
|
public int getReplicationQueueLength() {
|
||||||
if (this.server == null || this.server.getScheduler() == null) {
|
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return server.getScheduler().getReplicationQueueLength();
|
return server.getScheduler().getReplicationQueueLength();
|
||||||
|
@ -53,7 +57,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPriorityQueueLength() {
|
public int getPriorityQueueLength() {
|
||||||
if (this.server == null || this.server.getScheduler() == null) {
|
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return server.getScheduler().getPriorityQueueLength();
|
return server.getScheduler().getPriorityQueueLength();
|
||||||
|
@ -61,7 +65,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumOpenConnections() {
|
public int getNumOpenConnections() {
|
||||||
if (this.server == null || this.server.connectionList == null) {
|
if (!isServerStarted() || this.server.connectionList == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return server.connectionList.size();
|
return server.connectionList.size();
|
||||||
|
@ -69,7 +73,7 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getActiveRpcHandlerCount() {
|
public int getActiveRpcHandlerCount() {
|
||||||
if (this.server == null || this.server.getScheduler() == null) {
|
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return server.getScheduler().getActiveRpcHandlerCount();
|
return server.getScheduler().getActiveRpcHandlerCount();
|
||||||
|
|
Loading…
Reference in New Issue