You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2014/01/16 14:11:54 UTC
svn commit: r1558780 -
/sling/trunk/bundles/extensions/healthcheck/samples/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java
Author: bdelacretaz
Date: Thu Jan 16 13:11:54 2014
New Revision: 1558780
URL: http://svn.apache.org/r1558780
Log:
SLING-3278 - make SlowHealthCheckSample immediate to have a (somewhat) persistent counter
Modified:
sling/trunk/bundles/extensions/healthcheck/samples/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java
Modified: sling/trunk/bundles/extensions/healthcheck/samples/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/samples/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java?rev=1558780&r1=1558779&r2=1558780&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/healthcheck/samples/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java (original)
+++ sling/trunk/bundles/extensions/healthcheck/samples/src/main/java/org/apache/sling/hc/samples/impl/SlowHealthCheckSample.java Thu Jan 16 13:11:54 2014
@@ -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),