Millies, Sebastian wrote:
-----Original Message-----
From: Simon Nash [mailto:[email protected]]
Sent: Friday, December 10, 2010 10:21 AM
To: [email protected]
Subject: Re: Elementary question about Scopes

[snip]
I wouldn't recommend doing that.  With COMPOSITE scope, the SCA runtime
can control the creation and lifetime of the COMPOSITE instance rather
than being at the mercy of what the JVM does.  If the domain is entrely
contained within a single JVM, this distinction may not be important.
For other scenarios such as a server cluster or a distributed domain,
there will be multiple Java instances of the same SCA COMPOSITE-scoped
object, with updates coordinated by the SCA runtime. it is essential
that
the SCA runtime has the ability to manage this situation and give all
the JVMs the appearance of a single shared COMPOSITE-scoped object even
though the actual physical reality might be somewhat different.

[snip]
You could do what I suggested above: create another local object with
COMPOSITE scope and use the @Init method of that object to do the
one-time initialization.  By having a reference from your service
implementation to the other object, you can be sure that the other
object will have been initialized before the first service method of
your service implementation is invoked.

   Simon

Thanks for the excellent explanation and helpful suggestions. Perhaps the question was not entirely elementary after all.
-- Sebastian


You're very welcome.  Yes, definitely not elementary.  I did say at the
beginning that it was an interesting question :-)

  Simon

Reply via email to