code: public ServiceStatus getServiceStatus() {
          List<String> reasons = new ArrayList<String>();
  
          Status criticalStatus = Status.UP;
  
          for (MonitoredService m : criticals) {
              ServiceStatus serviceStatus = m.getServiceStatus();
              Status status = serviceStatus.getStatus();
  
              if (statusIsNotUp(status)) {
                  for (String reason : serviceStatus.getReasons()) {
                      reasons.add(serviceStatus.getName() + ":" + reason);
                  }
              }
  
              if (status.getValue() < criticalStatus.getValue()) {
                  criticalStatus = status;
              }
          }
  
          Status result = Status.UP;
  
          for (MonitoredService m : noncriticals) {
              ServiceStatus serviceStatus = m.getServiceStatus();
              Status status = serviceStatus.getStatus();
  
              if (statusIsNotUp(status)) {
                  for (String reason : serviceStatus.getReasons()) {
                      reasons.add(serviceStatus.getName() + ":" + reason);
                  }
                  result = Status.DEGRADED;
              }
          }
  
          if (criticalStatus.getValue() < result.getValue()) {
              result = criticalStatus;
          }
  
          return new ServiceStatus(name, result, reasons);
      }
docs: Get the {@link ServiceStatus} for the rolled up service.  The
  name for the ServiceStatus is the name of this rolled up service.
  The {@link Status} is computed based on the status of the critical
  and non-critical subsystems.  The {@link List} of reasons contains the
  reasons reported for each system. Each service returns the service
  name in addition to the reason that it has that status (which is
  reported by the service itself)
  
  @return the {@link ServiceStatus}.