use of org.apache.hadoop.ha.proto.HAServiceProtocolProtos.HAServiceStateProto in project hadoop by apache.
the class HAServiceProtocolServerSideTranslatorPB method getServiceStatus.
@Override
public GetServiceStatusResponseProto getServiceStatus(RpcController controller, GetServiceStatusRequestProto request) throws ServiceException {
HAServiceStatus s;
try {
s = server.getServiceStatus();
} catch (IOException e) {
throw new ServiceException(e);
}
HAServiceStateProto retState;
switch(s.getState()) {
case ACTIVE:
retState = HAServiceStateProto.ACTIVE;
break;
case STANDBY:
retState = HAServiceStateProto.STANDBY;
break;
case INITIALIZING:
default:
retState = HAServiceStateProto.INITIALIZING;
break;
}
GetServiceStatusResponseProto.Builder ret = GetServiceStatusResponseProto.newBuilder().setState(retState).setReadyToBecomeActive(s.isReadyToBecomeActive());
if (!s.isReadyToBecomeActive()) {
ret.setNotReadyReason(s.getNotReadyReason());
}
return ret.build();
}
Aggregations