sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SLING-5668) Models: Leverage ServletRequestListener.requestDestroyed for calling DisposalCallback in case the model was created from a request
Date Thu, 07 Dec 2017 21:31:00 GMT

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

ASF GitHub Bot commented on SLING-5668:
---------------------------------------

justinedelson commented on a change in pull request #1: SLING-5668 - Leverage ServletRequestListener.requestDestroyed
for cal…
URL: https://github.com/apache/sling-org-apache-sling-models-impl/pull/1#discussion_r155646620
 
 

 ##########
 File path: src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
 ##########
 @@ -1046,11 +1075,22 @@ protected ThreadInvocationCounter initialValue() {
 
         this.configPrinterRegistration = bundleContext.registerService(Object.class.getName(),
                 new ModelConfigurationPrinter(this, bundleContext, adapterImplementations),
printerProps);
+
+        Hashtable<Object, Object> listenerProps = new Hashtable<>();
 
 Review comment:
   Ah, I see what you mean now. Yeah, that might work.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Models: Leverage ServletRequestListener.requestDestroyed for calling DisposalCallback
in case the model was created from a request
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-5668
>                 URL: https://issues.apache.org/jira/browse/SLING-5668
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: Sling Models Impl 1.2.6
>            Reporter: Konrad Windszus
>
> Due to SLING-5664 I had to remove usage of {{SlingScriptHelper}} in the {{OSGiServiceInjector}}.
Therefore now always the {{DisposableCallbackRegistry}} is used to release service references.
That mechanism relies on a dedicated thread (https://github.com/apache/sling/blob/b864f105617c0ac7c2d525bfdb66eda2200c6460/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java#L133)
and phantom references (https://github.com/apache/sling/blob/b864f105617c0ac7c2d525bfdb66eda2200c6460/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java#L504).
In case of acting on top of a request one could leverage {{ServletRequestListener.requestDestroyed(...)}}
instead, which is more reliable and called earlier than relying on phantom references.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message