[ 
https://issues.apache.org/jira/browse/TUSCANY-2643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639826#action_12639826
 ] 

Simon Laws commented on TUSCANY-2643:
-------------------------------------

Hi Julien

I agree with;

 - if more than one component whose scope is composite share the same 
componentType (even inside an unique composite), each one will have its own 
implementation instance. 

Not sure I agree with;

 - if more than one composite instance (i.e. component whose implementation is 
implementation.composite) are instances of the same composite (they share the 
same type) and if this composite contains a component whose scope is composite, 
these will share the same implementation instance.

If I have

CompositeA
   Component1 - implementation.java -> MyClass - scope = COMPOSITE
   Component2 - implementation.java -> MyClass - scope = COMPOSITE

CompositeB
   Component3 - implementation.composite -> Composite A
   Component4 - implementation.composite -> Composite B

In line with your first comment, if I fire up CompositeA then I would expect 
     1 instance of Component1
     1 instance of Component2

If I fire up CompositeB then I would expect 
     1 instance of Component3/Component1
     1 instance of Component3/Component2
     1 instance of Component4/Component1
     1 instance of Component4/Component2

Sound right?

Simon


> composite scope handled incorectly
> ----------------------------------
>
>                 Key: TUSCANY-2643
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2643
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SCA
>    Affects Versions: Cpp-Next
>         Environment: Svn revision 704493
>            Reporter: Julien Bigot
>         Attachments: first-solution.patch, second-solution.patch
>
>
> Scope composite is not handled correctly.
> The actual behavior is to return the same implementation instance for all 
> call to a service of a component whose scope is composite. In the case where 
> there is more than one component with composite scope, this means that the 
> first implementation instantiated is returned regardless of the actual 
> component one is looking for.
> If the two components have a different ComponentType, this will likely lead 
> to a segfault.
> I have implemented another behavior.
> With my patch, when using a service of a composite implementation, the name 
> of the component is used as a unique ID, this is still not optimal as two 
> components can have the same name inside two different composite or if more 
> than one instance of  a given composite are created.
> This does not scale well too as a map is used. The straightforward solution 
> would be to have the implementation instance referenced in the Component 
> class. but as this class is defined in the tuscany::sca::model namespace, I'm 
> not sure it is Ok to modify it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to