Examples of HealthCheckResult


Examples of com.bazaarvoice.ostrich.HealthCheckResult

    @VisibleForTesting
    final class BatchHealthChecks implements Runnable {
        @Override
        public void run() {
            for (ServiceEndPoint endPoint : _badEndPoints) {
                HealthCheckResult result = checkHealth(endPoint);
                if (result.isHealthy()) {
                    _badEndPoints.remove(endPoint);
                }

                // If we were interrupted during checking the health (but weren't blocked so an InterruptedException
                // couldn't be thrown), then we should exit now.
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

    @Override
    public Result check() throws Exception {
        HealthCheckResults results = _pool.checkForHealthyEndPoint();
        boolean healthy = results.hasHealthyResult();
        HealthCheckResult healthyResult = results.getHealthyResult();

        // Get stats about any failed health checks
        int numUnhealthy = 0;
        long totalUnhealthyResponseTimeInMicros = 0;
        for (HealthCheckResult unhealthy : results.getUnhealthyResults()) {
            ++numUnhealthy;
            totalUnhealthyResponseTimeInMicros += unhealthy.getResponseTime(TimeUnit.MICROSECONDS);
        }

        if (!healthy && numUnhealthy == 0) {
            return Result.unhealthy("No end points.");
        }

        String unhealthyMessage = numUnhealthy + " failures in " + totalUnhealthyResponseTimeInMicros + "us";
        if (!healthy) {
            return Result.unhealthy(unhealthyMessage);
        }
        return Result.healthy(healthyResult.getEndPointId() + " succeeded in " +
                healthyResult.getResponseTime(TimeUnit.MICROSECONDS) + "us; " + unhealthyMessage);
    }
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

            _endPoint = endPoint;
        }

        @Override
        public void run() {
            HealthCheckResult result = checkHealth(_endPoint);
            if (result.isHealthy()) {
                _badEndPoints.remove(_endPoint);
            }
        }
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

    @VisibleForTesting
    final class BatchHealthChecks implements Runnable {
        @Override
        public void run() {
            for (ServiceEndPoint endPoint : _badEndPoints) {
                HealthCheckResult result = checkHealth(endPoint);
                if (result.isHealthy()) {
                    _badEndPoints.remove(endPoint);
                }

                // If we were interrupted during checking the health (but weren't blocked so an InterruptedException
                // couldn't be thrown), then we should exit now.
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

            if (endPoint == null) {
                // Load balancer didn't like our end points, so just go sequentially.
                endPoint = endPoints.iterator().next();
            }

            HealthCheckResult result = checkHealth(endPoint);
            aggregate.addHealthCheckResult(result);

            if (!result.isHealthy()) {
                Exception exception = ((FailedHealthCheckResult) result).getException();
                if (exception == null || isRetriableException(exception)) {
                    LOG.debug("Unhealthy end point discovered. End point ID: {}", endPoint.getId());
                    endPoints.remove(endPoint);
                    markEndPointAsBad(endPoint);
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

            if (endPoint == null) {
                // Load balancer didn't like our end points, so just go sequentially.
                endPoint = endPoints.iterator().next();
            }

            HealthCheckResult result = checkHealth(endPoint);
            aggregate.addHealthCheckResult(result);

            if (!result.isHealthy()) {
                Exception exception = ((FailedHealthCheckResult) result).getException();
                if (exception == null || isRetriableException(exception)) {
                    LOG.debug("Unhealthy end point discovered. End point ID: {}", endPoint.getId());
                    endPoints.remove(endPoint);
                    markEndPointAsBad(endPoint);
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

            _endPoint = endPoint;
        }

        @Override
        public void run() {
            HealthCheckResult result = checkHealth(_endPoint);
            if (result.isHealthy()) {
                _badEndPoints.remove(_endPoint);
            }
        }
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

    @VisibleForTesting
    final class BatchHealthChecks implements Runnable {
        @Override
        public void run() {
            for (ServiceEndPoint endPoint : _badEndPoints) {
                HealthCheckResult result = checkHealth(endPoint);
                if (result.isHealthy()) {
                    _badEndPoints.remove(endPoint);
                }

                // If we were interrupted during checking the health (but weren't blocked so an InterruptedException
                // couldn't be thrown), then we should exit now.
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

    @Override
    public Result check() throws Exception {
        HealthCheckResults results = _pool.checkForHealthyEndPoint();
        boolean healthy = results.hasHealthyResult();
        HealthCheckResult healthyResult = results.getHealthyResult();

        // Get stats about any failed health checks
        int numUnhealthy = 0;
        long totalUnhealthyResponseTimeInMicros = 0;
        for (HealthCheckResult unhealthy : results.getUnhealthyResults()) {
            ++numUnhealthy;
            totalUnhealthyResponseTimeInMicros += unhealthy.getResponseTime(TimeUnit.MICROSECONDS);
        }

        if (!healthy && numUnhealthy == 0) {
            return Result.unhealthy("No end points.");
        }

        String unhealthyMessage = numUnhealthy + " failures in " + totalUnhealthyResponseTimeInMicros + "us";
        if (!healthy) {
            return Result.unhealthy(unhealthyMessage);
        }
        return Result.healthy(healthyResult.getEndPointId() + " succeeded in " +
                healthyResult.getResponseTime(TimeUnit.MICROSECONDS) + "us; " + unhealthyMessage);
    }
View Full Code Here

Examples of com.bazaarvoice.ostrich.HealthCheckResult

    @Override
    public Result check() throws Exception {
        HealthCheckResults results = _pool.checkForHealthyEndPoint();
        boolean healthy = results.hasHealthyResult();
        HealthCheckResult healthyResult = results.getHealthyResult();

        // Get stats about any failed health checks
        int numUnhealthy = 0;
        long totalUnhealthyResponseTimeInMicros = 0;
        for (HealthCheckResult unhealthy : results.getUnhealthyResults()) {
            ++numUnhealthy;
            totalUnhealthyResponseTimeInMicros += unhealthy.getResponseTime(TimeUnit.MICROSECONDS);
        }

        if (!healthy && numUnhealthy == 0) {
            return Result.unhealthy("No end points.");
        }

        String unhealthyMessage = numUnhealthy + " failures in " + totalUnhealthyResponseTimeInMicros + "us";
        if (!healthy) {
            return Result.unhealthy(unhealthyMessage);
        }
        return Result.healthy(healthyResult.getEndPointId() + " succeeded in " +
                healthyResult.getResponseTime(TimeUnit.MICROSECONDS) + "us; " + unhealthyMessage);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.