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

Niclas Hedhman commented on POLYGENE-295:
-----------------------------------------

Yes, I think I concluded that the Service needs "implements ServiceActivation" 
and each of the mixins can probably "implements ServiceActivation" as well to 
get called.

"Activation" is only for Application, Layer and Module.

I am not sure about the semantics and use of "withActivators()", but I think it 
is annotation based.

 

And yes, the lazy initialization is tied to the Activation (not 
ServiceActivation) of Services, i.e. if the service is NOT 
instantiateOnStartUp(), the initialization of the service is NOT performed 
during the Activation phase of the application, but deferred to later, at which 
point we might be in a threaded environment and none of the code that builds 
the application is done with thread-safety in mind.

 

My main objection is that it is confusing to me (how about someone new), 
semantics are unclear and conflated with instantiation, with the lazy-bug as 
cream on top of it all.

> Activation broken
> -----------------
>
>                 Key: POLYGENE-295
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-295
>             Project: Polygene
>          Issue Type: Bug
>    Affects Versions: 2.0, 2.1, 3.0.0
>            Reporter: Niclas Hedhman
>            Priority: Major
>
> It is quite possible to get service calls before the activate() method has 
> been called. For instance, inject a Service into the constructor of an Object 
> and call objectFactory.newObject(). Even if instantiateOnStartup(), the 
> activation is not called first.
> On top of that, we have a general issue that the bootstrap code is not really 
> thread-safe (no effort was made on that), and lazy-initialization may cause 
> model corruption due to that, which kind of ties in with the Activation 
> system. I suspect that the above problem is some kind of mixing of concerns 
> and it gets messed up what is supposed to have happened already.
> Step 1; Fix that activation is ALWAYS called before method calls.
> Step 2; Discuss how to deal with lazy initialization. Either make sure that 
> everything in Core Runtime is thread-safe, or drop the current lazy 
> initialization, and possibly replace with a Concern instead (which intercepts 
> the activate() call, and make that happen upon next method call to the 
> service. That seems to be a lot more straight forward and also inline with 
> Polygene principles (eat your own dog food).
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to