You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Millies, Sebastian" <Se...@ids-scheer.com> on 2010/09/23 17:38:09 UTC

Composite-scoped components

Hello there,

I am somewhat confused about what composite scoped means in SCA.
If a component has composite scope, Tuscany will ensure that
the same instance is used for all requests. This sounds a lot
like the singleton pattern. 

Is it possible for an ordinary (non-SCA) Java client to discover and 
use that same instance directly? In what way does the Tuscany runtime 
come into play here? 

For example, when I access the service through a web service
binding, I do so through the Tuscany internal webserver, which
would ensure that the "singleton" is addressed. But what happens when
I retrieve a remote object manually from the rmi registry? Will it 
also point to the "singleton", or can it happen that a new service
component instance is created?

Is there an API to discover the services that are already instantiated 
in a domain/JVM/node (whatever)? The diverse factories in Tuscany seem to 
always want to construct new nodes or domains.

I am not even sure this question makes any sense at all...
-- Sebastian


Re: Composite-scoped components

Posted by Simon Nash <na...@apache.org>.
Millies, Sebastian wrote:
> Hello there,
> 
> I am somewhat confused about what composite scoped means in SCA.
> If a component has composite scope, Tuscany will ensure that
> the same instance is used for all requests. This sounds a lot
> like the singleton pattern. 
> 
> Is it possible for an ordinary (non-SCA) Java client to discover and 
> use that same instance directly? In what way does the Tuscany runtime 
> come into play here? 
> 
> For example, when I access the service through a web service
> binding, I do so through the Tuscany internal webserver, which
> would ensure that the "singleton" is addressed. But what happens when
> I retrieve a remote object manually from the rmi registry? Will it 
> also point to the "singleton", or can it happen that a new service
> component instance is created?
> 
Disclaimer: I'm not an expert in the RMI binding.  Here's how I think
this would work.  The singleton object wouldn't be registered with RMI.
Instead, a generated proxy that implements java.rmi.Remote would be
registered with RMI.  When this is invoked, it calls the Tuscany runtime
which determines the scope of the implementation and either invokes the
singleton or creates a new instance.

> Is there an API to discover the services that are already instantiated 
> in a domain/JVM/node (whatever)? The diverse factories in Tuscany seem to 
> always want to construct new nodes or domains.
> 
I don't think there are any APIs for application code to do this.  The
Tuscany runtime would be able to do this by looking at the runtime's
internal structures.  Others may have more information on this than I do.

   Simon

> I am not even sure this question makes any sense at all...
> -- Sebastian
>