[
http://jira.amdatu.org/jira/browse/AMDATUOPENSOCIAL-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11316#comment-11316
]
Ivo Ladage - van Doorn commented on AMDATUOPENSOCIAL-55:
--------------------------------------------------------
What happens is:
- The GuiceInjectorService is started
- The ShindigRegistrationService is started, which has a dependency on the
GuiceInjectorService
- The ShindigRegistrationService registers the GuiceInjectorService as a Servlet
- The ShindigRegistrationService continues to register other filters and
servlest, but all with a dependency on the GuiceInjectorServlet
- The GuiceInjectorService is initialized as a Servlet and finally registers
itself as a GuiceInjectorServlet
- The servlets and filters registered by ShindigRegistrationService and
depending on GuiceInjectorServlet are started
The problem is that the GuiceInjectorServlet must be the very first servlet
being registered, and must be initialized before any other filters or servlets
are.
Now there is no real need for the GuiceInjectorService to be consumed by the
ShindigRegistrationService as a service, it could simply invoke a non-service
method on it, as Bram suggests. The only reason for the service is automatic
injection of required services, like the LogService, SocialApiModule,
OAuthModule, ConfigurationAdminGuiceModule and DependencyManager. But these
could be added as input argument to the method being invoked.
> 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
> 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.
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