Package com.betfair.cougar.health.service.v3

Examples of com.betfair.cougar.health.service.v3.HealthSyncClientImpl



  @ManagedAttribute
  public boolean isSystemHealthy() {
    try {
      HealthStatus status = getDetailedHealthStatus(null, DefaultTimeConstraints.NO_CONSTRAINTS).getHealth();
      return status == HealthStatus.OK || status == HealthStatus.WARN;
   
    } catch (HealthException e) {
      return false;
    }
View Full Code Here


    }
    return response;
  }
 
  private RestrictedHealthStatus getHealth() throws HealthException {
    RestrictedHealthStatus currentState = RestrictedHealthStatus.OK;

        if (monitorRegistry == null) {
            logger.log(Level.SEVERE, "MonitorRegistry is null");
            throw new HealthException(ResponseCode.InternalError, HealthExceptionErrorCodeEnum.NULL);
        }
View Full Code Here

  private RestrictedHealthStatus getHealth() throws HealthException {
    RestrictedHealthStatus currentState = RestrictedHealthStatus.OK;

        if (monitorRegistry == null) {
            logger.log(Level.SEVERE, "MonitorRegistry is null");
            throw new HealthException(ResponseCode.InternalError, HealthExceptionErrorCodeEnum.NULL);
        }
        StatusAggregator agg = monitorRegistry.getStatusAggregator();
        if (agg == null) {
            logger.log(Level.SEVERE, "StatusAggregator is null");
            throw new HealthException(ResponseCode.InternalError, HealthExceptionErrorCodeEnum.NULL);
        }
        Status status = agg.getStatus();
        if (status == null) {
            logger.log(Level.SEVERE, "Status is null");
            throw new HealthException(ResponseCode.InternalError, HealthExceptionErrorCodeEnum.NULL);
        }
        if (status.equals(Status.FAIL)) {
            currentState = RestrictedHealthStatus.FAIL;
        }
    return currentState;
View Full Code Here

   
  }

  @Override
  public HealthDetailResponse getDetailedHealthStatus(RequestContext reqCtx, TimeConstraints timeConstraints) throws HealthException {
    HealthDetailResponse detail = new HealthDetailResponse();

        List<SubComponentStatus> subStatuses = new ArrayList<>();
        for (Monitor m : monitorRegistry.getMonitorSet()) {
            SubComponentStatus scs = new SubComponentStatus();
            scs.setName(m.getName());
            Status monitorStatus = m.getStatus();
            scs.setStatus(getHealthStatus(monitorStatus));
            subStatuses.add(scs);
        }
        detail.setSubComponentList(subStatuses);
    if (!isSystemInService()) {
      detail.setHealth(HealthStatus.OUT_OF_SERVICE);
    } else {
      detail.setHealth(getHealthStatus(monitorRegistry.getStatusAggregator().getStatus()));
    }
    return detail;
  }
View Full Code Here

        this.monitorRegistry = cc.getMonitorRegistry();
  }
 
  @Override
  public HealthSummaryResponse isHealthy(final RequestContext ctx, TimeConstraints timeConstraints) throws HealthException {
    HealthSummaryResponse response = new HealthSummaryResponse();
   
    if (isSystemInService()) {
      response.setHealthy(getHealth());
    } else {
      response.setHealthy(RestrictedHealthStatus.FAIL);

    }
    return response;
  }
View Full Code Here

  public HealthDetailResponse getDetailedHealthStatus(RequestContext reqCtx, TimeConstraints timeConstraints) throws HealthException {
    HealthDetailResponse detail = new HealthDetailResponse();

        List<SubComponentStatus> subStatuses = new ArrayList<>();
        for (Monitor m : monitorRegistry.getMonitorSet()) {
            SubComponentStatus scs = new SubComponentStatus();
            scs.setName(m.getName());
            Status monitorStatus = m.getStatus();
            scs.setStatus(getHealthStatus(monitorStatus));
            subStatuses.add(scs);
        }
        detail.setSubComponentList(subStatuses);
    if (!isSystemInService()) {
      detail.setHealth(HealthStatus.OUT_OF_SERVICE);
View Full Code Here

TOP

Related Classes of com.betfair.cougar.health.service.v3.HealthSyncClientImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.