Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5546810D78 for ; Wed, 15 Jan 2014 13:17:01 +0000 (UTC) Received: (qmail 24062 invoked by uid 500); 15 Jan 2014 13:17:00 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 23990 invoked by uid 500); 15 Jan 2014 13:16:59 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 23983 invoked by uid 99); 15 Jan 2014 13:16:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jan 2014 13:16:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jan 2014 13:16:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C926E2388993; Wed, 15 Jan 2014 13:16:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1558372 - in /sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor: ExecutionResult.java HealthCheckExecutorImpl.java Date: Wed, 15 Jan 2014 13:16:37 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140115131637.C926E2388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Wed Jan 15 13:16:37 2014 New Revision: 1558372 URL: http://svn.apache.org/r1558372 Log: SLING-3278 : Provide a HealthCheckExecutor service. Apply patch from Georg Henzler Modified: sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java Modified: sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java?rev=1558372&r1=1558371&r2=1558372&view=diff ============================================================================== --- sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java (original) +++ sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java Wed Jan 15 13:16:37 2014 @@ -64,22 +64,13 @@ public class ExecutionResult implements } /** - * Shortcut constructor to create error result. - */ - ExecutionResult(final HealthCheckMetadata metadata, - final Result.Status status, - final String errorMessage) { - this(metadata, new Result(status, errorMessage), 0L, false); - } - - /** * Shortcut constructor to create error/timed out result. */ ExecutionResult(final HealthCheckMetadata metadata, final Result.Status status, final String errorMessage, - final long elapsedTime) { - this(metadata, new Result(status, errorMessage), elapsedTime, true); + final long elapsedTime, boolean timedOut) { + this(metadata, new Result(status, errorMessage), elapsedTime, timedOut); } Modified: sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java?rev=1558372&r1=1558371&r2=1558372&view=diff ============================================================================== --- sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java (original) +++ sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java Wed Jan 15 13:16:37 2014 @@ -367,8 +367,9 @@ public class HealthCheckExecutorImpl imp result = future.get(); } catch (Exception e) { logger.warn("Unexpected Exception during future.get(): " + e, e); + long futureElapsedTimeMs = new Date().getTime() - future.getCreatedTime().getTime(); result = new ExecutionResult(future.getHealthCheckMetadata(), Result.Status.HEALTH_CHECK_ERROR, - "Unexpected Exception during future.get(): " + e); + "Unexpected Exception during future.get(): " + e, futureElapsedTimeMs, false); } // if the future came from a previous call remove it from stillRunningFutures @@ -388,13 +389,13 @@ public class HealthCheckExecutorImpl imp long futureElapsedTimeMs = new Date().getTime() - future.getCreatedTime().getTime(); if (futureElapsedTimeMs < this.longRunningFutureThresholdForRedMs) { result = new ExecutionResult(future.getHealthCheckMetadata(), Result.Status.WARN, - "Timeout: Check still running after " + msHumanReadable(futureElapsedTimeMs), futureElapsedTimeMs); + "Timeout: Check still running after " + msHumanReadable(futureElapsedTimeMs), futureElapsedTimeMs, true); } else { result = new ExecutionResult(future.getHealthCheckMetadata(), Result.Status.CRITICAL, "Timeout: Check still running after " + msHumanReadable(futureElapsedTimeMs) + " (exceeding the configured threshold for CRITICAL: " - + msHumanReadable(this.longRunningFutureThresholdForRedMs) + ")", futureElapsedTimeMs); + + msHumanReadable(this.longRunningFutureThresholdForRedMs) + ")", futureElapsedTimeMs, true); } } return result;