Fixed CodeHale implementation to changes in SPI.

Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/3dd42012
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/3dd42012
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/3dd42012

Branch: refs/heads/develop
Commit: 3dd420127ca30a452cd7e100130aa71994fc3620
Parents: 1451f9a
Author: niclas <[email protected]>
Authored: Sat Feb 25 13:53:04 2017 +0800
Committer: niclas <[email protected]>
Committed: Sat Feb 25 13:53:04 2017 +0800

----------------------------------------------------------------------
 .../polygene/metrics/codahale/CodahaleHealthCheck.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3dd42012/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleHealthCheck.java
----------------------------------------------------------------------
diff --git 
a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleHealthCheck.java
 
b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleHealthCheck.java
index e679d25..ebe8b5c 100644
--- 
a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleHealthCheck.java
+++ 
b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleHealthCheck.java
@@ -42,7 +42,17 @@ public class CodahaleHealthCheck
 
     static Result wrap( HealthCheck.Result result )
     {
-        return new Result( result.isHealthy(), result.getMessage(), 
result.getError() );
+        if( result.isHealthy() )
+        {
+            return Result.healthOk();
+        }
+        String message = result.getMessage();
+        Throwable error = result.getError();
+        if( error != null )
+        {
+            return Result.exception( message, error );
+        }
+        return Result.unhealthy( message );
     }
 
     static HealthCheck.Result unwrap( Result result )

Reply via email to