Hi,
This is interesting. In your case, you have two components
HelloworldDelegateComponent and HelloworldDelegateComponent2 that use the
same java implementation class: sample.HelloworldImpl which is composite
scoped. Now the question is how to interpret the following statement in the
SCA java spec:
295 1.2.4.3. Composite scope
296 All service requests are dispatched to the same implementation instance
for the lifetime of the containing
297 composite. The lifetime of the containing composite is defined as the
time it becomes active in the runtime
298 to the time it is deactivated, either normally or abnormally.
There are two ways:
1) There is going to be one instance of sample.HelloworldImpl (A) that are
shared by HelloworldDelegateComponent and HelloworldDelegateComponent2.
Requests to both components will be dispatched to A.
2) There are going to be two instances of sample.HelloworldImpl (A & B), one
for HelloworldDelegateComponent and the other for
HelloworldDelegateComponent2. Request to HelloworldDelegateComponent will be
dispatched to A while requests to HelloworldDelegateComponent2 will be
dispatched B.
It seems that Tuscany works in the 1st way. We need clarifications from the
spec group.
Thanks,
Raymond
From: Vamsavardhana Reddy
Sent: Wednesday, February 04, 2009 8:30 AM
To: [email protected]
Subject: Callback problem with COMPOSITE scoped implementation
I have a composite with three components as given below:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://sample"
name="HelloworldDelegate">
<component name="HelloworldXComponent">
<implementation.java class="sample.HelloworldImpl"/>
</component>
<component name="HelloworldDelegateComponent">
<implementation.java class="sample.HelloworldDelegateImpl"/>
<service name="HelloworldDelegate">
<binding.ws
uri="http://localhost:8080/tuscany/HelloworldDelegate"/>
</service>
<reference name="helloworld" target="HelloworldXComponent"/>
<property name="salutation">Monsieur</property>
</component>
<component name="HelloworldDelegateComponent2">
<implementation.java class="sample.HelloworldDelegateImpl"/>
<service name="HelloworldDelegate">
<binding.ws
uri="http://localhost:8080/tuscany/HelloworldDelegate2"/>
</service>
<reference name="helloworld" target="HelloworldXComponent"/>
<property name="salutation">Mr.</property>
</component>
</composite>
HelloworldImpl provides a Helloworld service and requires a
HelloworldCallback callback service.
HelloworldDelegateImpl provides HelloworldDelegate service and
HelloworldCallback service. There are two components, namely
HelloworldDelegateComponent (with salutation "Monsieur") and
HelloworldDelegateComponent2 (with salutation "Mr."). Both these components
invoke Helloworld service provided by HelloworldXComponent.
Both the implementations are COMPOSITE scoped.
When I use the HelloworldDelegate service from HelloworldDelegateComponent
the output I see in the console is the following:
HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@28e2f1).sayHello: vamsi
HelloworldXComponent:
HelloworldImpl(sample.helloworldi...@10076aa).sayHello: vamsi
HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@28e2f1).whoIs: vamsi
and the message got back is "Hello Monsieur vamsi".
------------------------------
When I use the HelloworldDelegate service from HelloworldDelegateComponent
the output I see in the console is the following:
HelloworldDelegateComponent2:
HelloworldDelegateImpl(sample.helloworlddelegatei...@146e74b).sayHello:
vamsi
HelloworldXComponent:
HelloworldImpl(sample.helloworldi...@10076aa).sayHello: vamsi
HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@28e2f1).whoIs: vamsi
and the message got back is "Hello Monsieur vamsi". I was expecting "Hello
Mr. vamsi".
Notice that in the second case, the callback service is called from
HelloworldDelegateComponent instead of HelloworldDelegateComponent2. Is this
the expected behaviour?
-----------------
If I make HelloworldImpl as STATELESS scoped (which is the default), then I
am seeing that the callback service is invoked on the same component that is
invoking the Helloworld service. The following is the output:
HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@1c704a7).sayHello:
vamsi
HelloworldXComponent:
HelloworldImpl(sample.helloworldi...@1af0f92).sayHello: vamsi
HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@1c704a7).whoIs: vamsi
Hello Monsieur vamsi
HelloworldDelegateComponent2:
HelloworldDelegateImpl(sample.helloworlddelegatei...@61dec0).sayHello: vamsi
HelloworldXComponent: HelloworldImpl(sample.helloworldi...@4f3d72).sayHello:
vamsi
HelloworldDelegateComponent2:
HelloworldDelegateImpl(sample.helloworlddelegatei...@61dec0).whoIs: vamsi
Hello Mr. vamsi
What am I missing?
++Vamsi