Hello there,

 

in section 5.8.5 of „Tuscany SCA in Action” a multi-client scenario involving 
callbacks 

is presented: There are two clients making requests to a CreditCardPayment 
service. 

The clients expect to be called back. There is only one CreditCardPayment 
instance 

(i. e. it has composite scope).

 

The authors go on to explain that it would be a bad idea to inject the callback

proxies into a CreditCardPayment instance member via a @Callback annotation, 

because in a multi-client scenario the callback reference would not be 
overwritten by

Tuscany, so the callback to the second client would go to the first client. And 
even

if it were overwritten, the approach would not be threadsafe.

 

Instead they recommend using a RequestContext object. However, it appears that

this object is injected into the service instance via a @Context annotation 
just like

a callback instance would be. I do not see how this improves anything, given 
that the

Tuscany runtime allows concurrent access to the service instance. How is the 
correct

result ensured when the CreditCardPayment service executes 
rqContext.getCallback() ? 

 

I do hope I have made myself clear,

Sebastian

 

PS: Is there any way to enforce a single-threaded execution model for access to 
a

service, as e. g. with servlets, without explicit synchronization?

 

Reply via email to