You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2015/05/05 10:27:06 UTC

[jira] [Comment Edited] (SLING-4417) HC Annotation should allow to configure "immediate" SCR property

    [ https://issues.apache.org/jira/browse/SLING-4417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14528114#comment-14528114 ] 

Carsten Ziegeler edited comment on SLING-4417 at 5/5/15 8:26 AM:
-----------------------------------------------------------------

This would be an option - kind of an optimization - but I think it's not the task of the HC core to provide a way for implementations to keep state. (so this is independent)
For example if a HealthCheck is implemented without DS, you usually have a singleton registered in the service registry. Therefore it's really an implementation concern - if the component needs to keep state between runs it's its task to keep the state in one way or the other.


was (Author: cziegeler):
This would be an option - kind of an optimization - I think it's not the task of the HC core to provide a way for implementations to keep state.
For example if a HealthCheck is implemented without DS, you usually have a singleton registered in the service registry. Therefore it's really an implementation concern - if the component needs to keep state between runs it's its task to keep the state in one way or the other.

> HC Annotation should allow to configure "immediate" SCR property
> ----------------------------------------------------------------
>
>                 Key: SLING-4417
>                 URL: https://issues.apache.org/jira/browse/SLING-4417
>             Project: Sling
>          Issue Type: New Feature
>          Components: Health Check
>            Reporter: Georg Henzler
>         Attachments: SLING-4417-HC-Annotation-with-immediate-setting.patch
>
>
> When using @SlingHealthCheck at the moment, the "immediate" property is left to "false" in the SCR descriptor which causes the component object to be created on every call of the health check (making it impossible to keep some state in a private member variable if desired). 
> Let's make the immediate property configurable (the same way it would be provided in the @Component annotation) and make immediate="true" the default (this is a slight change in the behaviour that will not break existing code) for the following reasons:
> - It's more intuitive to think of a HC as singleton (and hence be able to keep some instance variables)
> - It's a tiny little bit better from a performance perspective (the instance does not have to be created on each execution)
> The attached patch includes the (fairly simple) change to annotation(-processor) and the change for two sample components that were using @Component because of this issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)