Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-4417

HC Annotation should allow to configure "immediate" SCR property

    XMLWordPrintableJSON

Details

    • Patch

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              kwin Konrad Windszus
              henzlerg Georg Henzler
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: