[ 
https://issues.apache.org/jira/browse/SLING-11119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Radu Cotescu updated SLING-11119:
---------------------------------
    Description: The bundled scripts currently have an OSGi service cache per 
instance, however in the 
{{org.apache.sling.scripting.core.impl.bundled.ScriptContextProvider}} there's 
already a service cache per bundle context which could be reused. This would 
save significant memory in systems where there are a lot of bundled scripts.  
(was: The current implementation of 
{{org.apache.sling.scripting.sightly.impl.engine.bundled.BundledUnitManagerImpl}}
 relies on the actual {{BundledRenderUnit}} to retrieve OSGi services that are 
used by the bundled (precompiled) script. That implementation is provided by 
the 
{{org.apache.sling.scripting.core.impl.bundled.AbstractBundledRenderUnit#getService}}
 method, but, given its execution context, it has a shorter lived cache in 
which OSGi services are kept. In addition, that implementation is currently 
affected by SLING-11118.

Since the 
{{org.apache.sling.scripting.core.impl.bundled.ScriptContextProvider}} service 
actually provides a {{org.apache.sling.scripting.core.ScriptHelper}} 
implementation capable of retrieving OSGi services with the correct classloader 
that provides the bundled (precompiled) script, the HTL 
{{org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider}}
 should try to use the {{ScriptHelper}} in this scenario, if one is available, 
otherwise fallback to the {{BundledRenderUnit}} like before.)

> Optimise service retrieval for bundled scripts
> ----------------------------------------------
>
>                 Key: SLING-11119
>                 URL: https://issues.apache.org/jira/browse/SLING-11119
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Radu Cotescu
>            Assignee: Radu Cotescu
>            Priority: Major
>             Fix For: Scripting Core 2.4.4
>
>
> The bundled scripts currently have an OSGi service cache per instance, 
> however in the 
> {{org.apache.sling.scripting.core.impl.bundled.ScriptContextProvider}} 
> there's already a service cache per bundle context which could be reused. 
> This would save significant memory in systems where there are a lot of 
> bundled scripts.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to