[ 
http://jira.amdatu.org/jira/browse/AMDATUOPENSOCIAL-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11684#comment-11684
 ] 

Marcel Offermans commented on AMDATUOPENSOCIAL-55:
--------------------------------------------------

That is correct, if a different or higher ranked version of a required 
dependency becomes available, it will be injected directly, so you might still 
end up talking to "the wrong" dependency (and worse, one instance will talk to 
the new one, the other to the old one).

Solutions could be to use:
- a composition (the DM will ask the component for an array of instances and it 
will attempt to inject dependencies into all of them);
- callback handlers so you can update the dependencies manually.

                
> Shindig bootstrap service/composite code smells and is incomprehensible
> -----------------------------------------------------------------------
>
>                 Key: AMDATUOPENSOCIAL-55
>                 URL: http://jira.amdatu.org/jira/browse/AMDATUOPENSOCIAL-55
>             Project: Amdatu OpenSocial
>          Issue Type: Improvement
>            Reporter: Bram de Kruijff
>            Assignee: Ivo Ladage - van Doorn
>             Fix For: 0.2.0
>
>
> This is about how the OpenSocial shindig bundle bootstraps its services. Just 
> logging this because I ran into it while refactoring HttpContext and got into 
> a deadlock caused by a lock in a a callback. Took me an hour to get some 
> understanding of what is happening. My initial suggestion would be to change 
> the GuiceInjectorServiceImpl part from service to simple delegate to 
> ShindigRegistrationServiceImpl removing the need for complex orchestration 
> through service dependencies. 
> 01. Activator adds Component GuiceInjectorService|GuiceInjectorServiceImpl to 
> DepManager
> 02. DepManager starts GuiceInjectorService!GuiceInjectorServiceImpl#instance 
> (1st time on instance)
> 03. Activator adds Component 
> ResourceProvider,ShindigService|ShindigRegistrationServiceImpl to DepManager
> 04. DepManager injects GuiceInjectorService|GuiceInjectorServiceImpl#instance 
> into ShindigRegistrationServiceImpl
> 05. DepManager inits ShindigRegistrationServiceImpl (seems previsous step 
> always in time...?)
> 06. ShindigRegistrationServiceImpl.init() add Component 
> Servlet|GuiceInjectorServiceImpl#instance to DepManager
> 07. DepManager does starts Servlet|GuiceInjectorServiceImpl#instance (2nd 
> time on instance)
> 08. DepManager does callback to DispatcherService.servletAdded with 
> Servlet|GuiceInjectorServiceImpl#instance  
> 09. DispatcherService does init(ServletConfig) on 
> Servlet|GuiceInjectorServiceImpl#instance  
> 10. Servlet|GuiceInjectorServiceImpl#instance.init(ServletConfig) adds 
> Component GuiceInjectorServlet!GuiceInjectorServiceImpl#instance
> 11. DepManager starts GuiceInjectorServlet!GuiceInjectorServiceImpl#instance 
> (3rd time on instance)
> 12. DepManager injects GuiceInjectorServlet!GuiceInjectorServiceImpl#instance 
> into ResourceProvider,ShindigService|ShindigRegistrationServiceImpl
> 13. DepManager starts 
> ResourceProvider,ShindigService|ShindigRegistrationServiceImpl
> 14. ResourceProvider,ShindigService|ShindigRegistrationServiceImpl ads 
> several Components for servlets
> 15 DepManager does callback to DispatcherService.servletAdded for previsous 
> step

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
http://jira.amdatu.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to