sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-hc-samples] 16/42: SLING-3278 - make SlowHealthCheckSample immediate to have a (somewhat) persistent counter
Date Fri, 20 Oct 2017 14:38:51 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-samples.git

commit f12ef109129a44576a7f9afecd6f7467e105a847
Author: Bertrand Delacretaz <bdelacretaz@apache.org>
AuthorDate: Thu Jan 16 13:11:54 2014 +0000

    SLING-3278 - make SlowHealthCheckSample immediate to have a (somewhat) persistent counter
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1558780 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java b/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java
index 1ee3363..19e1783 100644
--- a/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java
+++ b/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java
@@ -38,10 +38,17 @@ import org.slf4j.LoggerFactory;
 /** Sample Health Check that takes N msec to execute,
  *  used to demonstrate execution timeouts and caching.
  */
+
+// Need to make the component immediate to make sure a single 
+// instance is used, otherwise the lazy DS activation policy
+// might cause a different instance to be used for every
+// execution. In this sample this is just done to allow the
+// counter to persist as long as this service's bundle is active.
 @Component(
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
-        metatype=true)
+        metatype=true,
+        immediate=true)
 @Properties({
     @Property(name=HealthCheck.NAME),
     @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),

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

Mime
View raw message