You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:40:01 UTC

[sling-org-apache-sling-hc-webconsole] 09/21: Correctly free service references

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.hc.webconsole-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-webconsole.git

commit cd33e3132d0f5cd8512cd261353347cca740827c
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Sep 2 14:47:08 2013 +0000

    Correctly free service references
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/webconsole@1519454 13f79535-47bb-0310-9956-ffa450edef68
---
 .../webconsole/impl/HealthCheckWebconsolePlugin.java   | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java b/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
index 9216c23..0f0de37 100644
--- a/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
+++ b/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
@@ -113,13 +113,17 @@ public class HealthCheckWebconsolePlugin extends HttpServlet {
             for(final ServiceReference ref : references) {
                 final HealthCheck hc = (HealthCheck) this.bundleContext.getService(ref);
                 if ( hc != null ) {
-                    final Result r = hc.execute();
-                    total++;
-                    if (!r.isOk()) {
-                        failed++;
-                    }
-                    if (!quiet || !r.isOk()) {
-                        renderResult(resp, ref, hc, r, debug);
+                    try {
+                        final Result r = hc.execute();
+                        total++;
+                        if (!r.isOk()) {
+                            failed++;
+                        }
+                        if (!quiet || !r.isOk()) {
+                            renderResult(resp, ref, hc, r, debug);
+                        }
+                    } finally {
+                        this.bundleContext.ungetService(ref);
                     }
                 }
             }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.