incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1519436 - /sling/trunk/contrib/extensions/healthcheck/jmx/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
Date Mon, 02 Sep 2013 13:26:28 GMT
Author: cziegeler
Date: Mon Sep  2 13:26:28 2013
New Revision: 1519436

URL: http://svn.apache.org/r1519436
Log:
Simplify code

Modified:
    sling/trunk/contrib/extensions/healthcheck/jmx/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java

Modified: sling/trunk/contrib/extensions/healthcheck/jmx/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/jmx/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java?rev=1519436&r1=1519435&r2=1519436&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/healthcheck/jmx/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
(original)
+++ sling/trunk/contrib/extensions/healthcheck/jmx/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
Mon Sep  2 13:26:28 2013
@@ -134,24 +134,21 @@ public class HealthCheckMBean implements
                 if ( defaultValue != null ) {
                     result.add(new Attribute(key, defaultValue));
                 } else {
+                    // we assume that a valid attribute name is used
+                    // which is requesting a hc result
+                    if ( hcResult == null ) {
+                        hcResult = this.healthCheck.execute();
+                    }
+
                     if ( HC_OK_ATTRIBUTE_NAME.equals(key) ) {
-                        if ( hcResult == null ) {
-                            hcResult = this.healthCheck.execute();
-                        }
                         result.add(new Attribute(key, hcResult.isOk()));
                     } else if ( HC_LOG_ATTRIBUTE_NAME.equals(key) ) {
-                        if ( hcResult == null ) {
-                            hcResult = this.healthCheck.execute();
-                        }
                         try {
                             result.add(new Attribute(key, logData(hcResult)));
                         } catch ( final OpenDataException ignore ) {
                             // we ignore this and simply don't add the attribute
                         }
                     } else if ( HC_STATUS_ATTRIBUTE_NAME.equals(key) ) {
-                        if ( hcResult == null ) {
-                            hcResult = this.healthCheck.execute();
-                        }
                         result.add(new Attribute(key, hcResult.getStatus().toString()));
                     }
                 }



Mime
View raw message