incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
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 GMT
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;



Mime
View raw message