[
https://issues.apache.org/jira/browse/SLING-2558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433130#comment-13433130
]
Carsten Ziegeler commented on SLING-2558:
-----------------------------------------
Committed first version which uses a concurrent hash map for the cache, I've
reduced the syncs on the factories (which I renamed to descriptions) to the
bare minimum
Removed the sync in the AdapterFactoryDescriptor
In addition, factories are now really fetched lazy when they are first used
> Potential Deadlocks may be caused by AdapterManager
> ---------------------------------------------------
>
> Key: SLING-2558
> URL: https://issues.apache.org/jira/browse/SLING-2558
> Project: Sling
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: Adapter 2.0.16
> Reporter: Felix Meschberger
> Assignee: Carsten Ziegeler
> Fix For: Adapter 2.0.18
>
>
> The AdapterManager uses a cascade of three synchronized blocks when the
> AdapterFactoryDescriptor.getFactory() method is called:
> * synchronized(cache)
> * synchronized(factories)
> * synchronized(this)
> A potential deadlock may happen because the
> AdapterFactoryDescriptor.getFactory() method asks the Declarative Services
> runtime for a service, which may cause a ServiceFactory service to be
> instantiated (with a whole cascade of potential secondary actions depending
> on what happens on this instantiation).
> The last block can probably simply be removed while the others definitely
> have to be refactored to not be the cause or participants in deadlock
> situations. The reason for this is, that (a) synchronized blocks must not be
> too large and (b) no Java locks should be held when calling into the OSGi
> Framework, which happens in the AdapterFactoryDescriptor.getFactory method.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira